Add a way to do intermediate aggregation