Clean up AggregateBy handling.