dev: refactor map. Fixed the weird edge-of-map bugs