refactor app.js to organize code