Changed Split up main.js to allow for better maintainability #38