improve testGrouping, see #9, thanks @pwielgolaski