Implemented setThreshold