Moved a bunch of stuff around to organize for require js and proper modules.