Added checkValue function