Move "global" code to main.js file