added upper and lower thresh to kalman