Lots of refactoring, removed a ton of unneeded code.