Refactored timer to counter