added boundary uniqueness check