Filtered and improved thresholding