Move js code from index.html into an individual file