Small refactor in app.js to pass along the document object easier