add thresholding and soomthing