Loads of cleanup, new code, and reorginizing