More refactoring to clean things up and clarify their purpose