Another round of refactoring.