Refactoring a lot of crap.