moved all JS parts from index.html in index.js