moved main.js script loading to the end - #3
merged from origin