moved some of the JS from index.html to index.js