reorganized app.js