Moved the JS code to main.js

And I checked that it continues to run. Yes, it does. ;)