Moved minGroupBy to util.