Adding the validator logic