Code cleanup for module generator