Added groupBy method