Refactoring things in preparation for work on multi-aggregation.