added to findThreshold()