Added all needed functionality to almost make thresholding work in the
GUI