Main.js code clean up.