Added simple thresholding.