Clean and organize the map.js file