added type to group by