refactor(task): move out of closures