thresholding method added but not yet complete