Moved code into main.js