Clean up code in map.js
Re-factor to include latest version of mapbox source files