naive thresholding algorithm