Ton of map generation code