modularized the timer