Mostly refactoring.