slight refactor app.js