Initial refactoring.