move code out of app.js that doesn't belong there