code cleanup
more work on ModuleManager.