WIP: complete recode of 90% of map-related shit.

Non-functional.