Clean up main.js code