move all code to app.js