Efficiency updates for new get_matching_groups rules handling