complete the timer function