Refactored out ExternalCommand and associated code.