Refactor app.js.