small changes to group matching