Move functions from app.js to index.html