Move threshold calculation within timer.