Moved JavaScript from index.html to main.js