Mapgen fixes. Added factories (wip).