added nested aggregation