Added a reducer to group results