added validation to the model