Major cleanup of menu.js and moving around functions