More refactoring work