Refactored timer into directive