move some logic from DOM to TaskManager