Lots of refactoring of things.