added group by function, group by function