Moved find_set_with_element out of class as helper function.