completes app.js logic, adds comments, fixes indentation