DRY refactoring for tests and timer fix