diff --git a/transport.install b/transport.install
index c825b50..750cebd 100644
--- a/transport.install
+++ b/transport.install
@@ -66,7 +66,7 @@ function transport_schema() {
       'source' => array(
         'description' => 'The name of the source.',
         'type' => 'varchar',
-        'length' => '32',
+        'length' => '128',
         'not null' => TRUE,   
       ),
       'id_remote' => array(
@@ -120,3 +120,30 @@ function transport_uninstall() {
   drupal_uninstall_schema('transport');
 }
 
+
+/**
+ * Implementation of hook_update_N().
+ *
+ * Increase the length of the 'source' field in {transport_entity_remote}.
+ */
+function transport_update_6001(&$sandbox) {
+  $ret = array();
+
+  // We have to drop and re-add our primary key ourselves as
+  // just using db_change_field() causes an error; bug in core presumably.
+  db_drop_primary_key($ret, 'transport_entity_remote');
+
+  db_change_field($ret, 'transport_entity_remote', 'source', 'source',
+    array(
+      'description' => 'The name of the source.',
+      'type' => 'varchar',
+      'length' => '128',
+      'not null' => TRUE,
+    )
+  );
+
+  db_add_primary_key($ret, 'transport_entity_remote', array('source', 'type', 'id_remote'));
+
+  return $ret;
+}
+
diff --git a/transport_debug/transport_debug.module b/transport_debug/transport_debug.module
index db8f490..3125740 100644
--- a/transport_debug/transport_debug.module
+++ b/transport_debug/transport_debug.module
@@ -35,26 +35,31 @@ function transport_debug_menu() {
 /**
  * Test page menu callback.
  */
-function transport_debug_page($connection_id = NULL, $type = 'node', $remote_id = NULL) {
+function transport_debug_page($connection_name = NULL, $type = 'node', $remote_id = NULL) {
   $output = 'This page is a debug tool for the transport layer. ';
   $output .= 'It begins by creating a Client, which it then passes to a Transport controller. ';
   $output .= 'The Transport controller retrieves a remote entity and saves it along with dependencies. ';
   
   // Get our client connection.
-  if (!isset($connection_id)) {
-    $connection_id = variable_get('transport_debug_client_connection', NULL);    
+  if (!isset($connection_name)) {
+    $connection_name = variable_get('transport_debug_client_connection', NULL);
   }
-  if (is_null($connection_id)) {
+  if (is_null($connection_name)) {
     drupal_set_message(t('No connection has been set up.'), 'warning');
     return $output;
   }
 
-  $connection = clients_get_connection($connection_id);
+  $connection = clients_connection_load($connection_name);
+  if (is_null($connection)) {
+    drupal_set_message(t('Invalid connection name.'), 'warning');
+    return $output;
+  }
+
   drupal_set_title('transport debug - ' . $connection->type);
 
   // Create our transport controller.
   // Define an arbitrary name to identify the source.
-  $source_name = "drupal-client-$connection_id";
+  $source_name = "drupal-client-$connection_name";
   $options = array();
   $transport_controller = new TransportControllerRetriever($source_name, $connection, $options);
   //dpm($transport_controller);
diff --git a/transport_demo/transport_demo.module b/transport_demo/transport_demo.module
index 8dd2931..18ed3b1 100644
--- a/transport_demo/transport_demo.module
+++ b/transport_demo/transport_demo.module
@@ -79,13 +79,13 @@ function transport_demo_retrieve_form_submit($form, &$form_state) {
   //dsm($form_state['values']);
   
   // Get our client connection.
-  $connection_id = $form_state['values']['connection'];
-  $connection = clients_get_connection($connection_id);
+  $connection_name = $form_state['values']['connection'];
+  $connection = clients_connection_load($connection_name);
   //dsm($connection);
   
   // Create our transport controller.
   // Define an arbitrary name to identify the source.
-  $source_name = "transport-demo-$connection_id";
+  $source_name = "transport-demo-$connection_name";
   $options = array();
   $transport_controller = new TransportControllerRetriever($source_name, $connection, $options);
 
diff --git a/transport_retrieve_service/transport_retrieve_service.inc b/transport_retrieve_service/transport_retrieve_service.inc
index 145e7aa..8104670 100644
--- a/transport_retrieve_service/transport_retrieve_service.inc
+++ b/transport_retrieve_service/transport_retrieve_service.inc
@@ -23,21 +23,25 @@ function transport_retrieve_service_get_access() {
 /**
  * Service callback.
  *
+ * @param $connection_name
+ *  The machine name of a connection.
+ * @param $entities
+ *  A list of entities in the format used by TransportControllerRetriever::beginRetrieval().
+ *
  * @return
  *  TRUE for success, FALSE for failure.
  */
-function transport_retrieve_service_retrieve($client_endpoint, $entities) {
+function transport_retrieve_service_retrieve($connection_name, $entities) {
   // Really bogus: sleep for long enough for the remote site to
   // save its image, etc etc.
   sleep(2); 
   
-  // Get the connection based on the endpoint... weak :(
-  $connection_id = _transport_retrieve_service_client_get_cid_by_endpoint($client_endpoint);
-  $connection = clients_get_connection($connection_id);
+  // Get the connection based on the give machine name.
+  $connection = clients_connection_load($connection_name);
   
   // Create our transport controller.
   // Define an arbitrary name to identify the source.
-  $source_name = "transport-$connection_id";
+  $source_name = "transport-$connection_name";
   $options = array();
   $transport_controller = new TransportControllerRetriever($source_name, $connection, $options);
   
@@ -46,11 +50,3 @@ function transport_retrieve_service_retrieve($client_endpoint, $entities) {
  
   return TRUE; 
 }
-
-/**
- * Ugly helper function to get a client cid by its endpoint.
- */
-function _transport_retrieve_service_client_get_cid_by_endpoint($endpoint) {
-  $result = db_query("SELECT cid FROM {clients_connections} WHERE endpoint = '%s'", $endpoint);
-  return db_result($result);
-}
diff --git a/transport_retrieve_service/transport_retrieve_service.module b/transport_retrieve_service/transport_retrieve_service.module
index df18c6f..0027d4c 100644
--- a/transport_retrieve_service/transport_retrieve_service.module
+++ b/transport_retrieve_service/transport_retrieve_service.module
@@ -26,9 +26,9 @@ function transport_retrieve_service_service() {
       '#file'             => array('file' => 'inc', 'module' => 'transport_retrieve_service'),
       '#args'             => array(
         array(
-          '#name'           => 'client',
+          '#name'           => 'connection',
           '#type'           => 'string',
-          '#description'    => t('A client endpoint.'),
+          '#description'    => t('A connection machine name.'),
         ),
         array(
           '#name'           => 'entities',
