refactor: get controller code out of app.js