refactor app.coffee