implemented checkThreshold.