Revised grouped_items method