reorganizing app.js file