Extracted some common bits and integrated external and service