Move logic back to app.js