Rearrange the timer function