Services decoupling

Cherry picks the de-coupling changes in #955, and fixes review remarks.