Refactored to centralize the identity constraint.