refactor(task): isolate function in scope