Moving main script to js/main.js