Some cleanup of the aggregation API