Simplified the set_membership method