groupBy method added