move some callbacks to promises