Refactor => main js, move the  behavior to manage events on map layer to another script, see mapEventManager.js.coffee