refactor timer api