Major refactoring, was a complete mess, still is.