Start of the first big refactoring.