Move from external map.js
Merge branch 'refactor'