Mostly clean-up and refactoring.