Refactor locations.js.coffee