Finalize the aggregation logic