continues refactoring, breaks code into module groups