More refactoring and more code