Added better validation to the model