Cleaned up main.js a bit