main.js cleanup code