Added groupBySync and tests