clean up code in main.js