updated aggregation script