map.js - small refactor