Refactor the timer