more refactoring for map.js