Order of functions in main.js updated