Did a ton of refactoring.