timer refactoring