Updated main.js file for modularity.