Added better grouping support