Refactor the serial aggregation execution into two functions