Added ModuleFactory and modified module structure.