refactor controllers.js.coffee and other files