More refactoring and simplifying