refactored into genModules()