Moving logic to app.js in prep for #1.