Refactored timer