More refactoring and refining.