added group by clause