added comments to app.js and made minor improvements