created main.js and switched all the code in html there