added groupby to API