Moved JavaScript code to index.html