[DF-883] add basic grouping logic