Moved event handling to index.html