Updated logic for validator.