set based matching for efficiency