code cleanup: mainly map.js