Move code to index.html