Added thresholding