added some additional functions to make plots seen in the paper, and thresholding functions