added debugging for finding threshold values