implemented thresholdThread