Refactored map generator