groupby & where_terms + Tests