Refactored the timer.