Added an upper threshold that reverses direction