Moved required packages code into the main class to get rid of duplication.