Reorganize app.js a bit