added commands to findThreshold()