[SETUPLIB][USETUP] Move some code to the SetupLib.