More refactoring to simplify things