More refactoring stuff