Condensed code for map.js