refactoring countdown timer