Tonnes of refactoring