refractored timer