Added validation for min and max.