Cleaned up more of the main.js file.