Cleaning main.js up a bit