Beginning cleanup. WHEEE
Eventually this code will be a lot prettier, and probably more functional.