refactored app.js and index.html