cleaned up main.js a bit