Refactor map.js more