multi-level grouping performance improvement; got rid of single-level aggregation