prototype better thresholding