Added boxcar/thresholding code by Kondo et al.