Start of some refactoring.