Refactored app.js and added documentation for changes yet