Refactoring mostly complete.