Refactor timer