added the minLength and maxLength constraints