More breaking up of the code to modules for version 3