Rewritten check for uniqueness