Cleaning up the modules. Breaking out into lib files.