very different when aggregation is required or not... need judge code