Massive refactorings to get to a better place.