changed to dynamic thresholding.