Refactor `Task` tick listener logic and improve `TimerMachine` behavior handling #146