diff() and applyThreshold() that is.