Fixed termination condition to trigger after threshold (rather than on it).