diff --git a/xmlsitemap.admin.inc b/xmlsitemap.admin.inc
index c707fc9b16350a10d1e919e2ad682c7c799bff98..95bb09d09056d8e9bf00170e647052e9fee7a035 100644
--- a/xmlsitemap.admin.inc
+++ b/xmlsitemap.admin.inc
@@ -35,24 +35,25 @@ function xmlsitemap_sitemap_list_form() {
     '#submit' => array('xmlsitemap_sitemap_list_submit'),
   );
 
-  $query = db_select('xmlsitemap_sitemap');
-  $query->fields('xmlsitemap_sitemap', array('smid'));
-  $smids = $query->execute()->fetchCol();
-
   $contexts = xmlsitemap_get_context_info();
 
   $header = array();
-  $header['url'] = array('data' => t('URL'), 'field' => 'url');
+  $header['url'] = array('data' => t('URL'));
   foreach ($contexts as $context_key => $context_info) {
     if (!empty($context_info['summary callback'])) {
       $header['context_' . $context_key] = $context_info['label'];
     }
   }
-  $header['updated'] = array('data' => t('Last updated'), 'field' => 'updated');
+  $header['updated'] = array('data' => t('Last updated'), 'field' => 'updated', 'sort' => 'asc');
   $header['links'] = array('data' => t('Links'), 'field' => 'links');
   $header['chunks'] = array('data' => t('Pages'), 'field' => 'chunks');
   $header['operations'] = array('data' => t('Operations'));
 
+  $query = db_select('xmlsitemap_sitemap');
+  $query->fields('xmlsitemap_sitemap', array('smid'));
+  $query->extend('TableSort')->orderByHeader($header);
+  $smids = $query->execute()->fetchCol();
+
   $options = array();
   $destination = drupal_get_destination();
   foreach ($smids as $smid) {
@@ -62,7 +63,7 @@ function xmlsitemap_sitemap_list_form() {
     $options[$smid]['url'] = array(
       'data' => array(
         '#type' => 'link',
-        '#title' => url($sitemap['uri']['path'], $sitemap['uri']['options']),
+        '#title' => $sitemap['uri']['url'],
         '#href' =>  $sitemap['uri']['path'],
         '#options' =>  $sitemap['uri']['options'],
       ),
@@ -77,13 +78,11 @@ function xmlsitemap_sitemap_list_form() {
     $options[$smid]['chunks'] = $sitemap['updated'] ? $sitemap['chunks'] : '-';
 
     $operations = array();
-    //if (!empty($sitemap['context'])) {
-      $operations['edit'] = array(
-        'title' => t('Edit'),
-        'href' => 'admin/config/search/xmlsitemap/edit/' . $smid,
-        'query' => $destination,
-      );
-    //}
+    $operations['edit'] = array(
+      'title' => t('Edit'),
+      'href' => 'admin/settings/xmlsitemap/edit/' . $smid,
+      'query' => $destination,
+    );
     $operations['delete'] = array(
       'title' => t('Delete'),
       'href' => 'admin/config/search/xmlsitemap/delete/' . $smid,
@@ -153,7 +152,7 @@ function xmlsitemap_sitemap_list_submit($form, &$form_state) {
     call_user_func_array($function, $args);
 
     $count = count($form_state['values']['sitemaps']);
-    watchdog('xmlsitemap', '@action @count XML sitemaps.', array('@action' => $operation['action past'], '@count' => $count));
+    //watchdog('xmlsitemap', '@action @count XML sitemaps.', array('@action' => $operation['action past'], '@count' => $count));
     drupal_set_message(format_plural(count($sitemaps), '@action @count XML sitemap.', '@action @count XML sitemaps.', array('@action' => $operation['action past'], '@count' => $count)));
     //$form_state['redirect'] = 'admin/config/search/xmlsitemap';
   }
@@ -222,7 +221,7 @@ function xmlsitemap_sitemap_edit_form_submit($form, &$form_state) {
   form_state_values_clean($form_state);
   xmlsitemap_sitemap_save($form_state['values']);
   $uri = xmlsitemap_sitemap_uri($form_state['values']);
-  drupal_set_message(t('The sitemap %sitemap was saved.', array('%sitemap' => url($uri['path'], $uri['options']))));
+  drupal_set_message(t('The sitemap %sitemap was saved.', array('%sitemap' => $uri['url'])));
   $form_state['redirect'] = 'admin/config/search/xmlsitemap';
 }
 
@@ -250,7 +249,7 @@ function xmlsitemap_sitemap_delete_form(&$form, $form_state, array $sitemap) {
 function xmlsitemap_sitemap_delete_form_submit($form, $form_state) {
   xmlsitemap_sitemap_delete($form_state['values']['smid']);
   $uri = xmlsitemap_sitemap_uri($form['#sitemap']);
-  drupal_set_message(t('The sitemap %sitemap was deleted.', array('%sitemap' => url($uri['path'], $uri['options']))));
+  drupal_set_message(t('The sitemap %sitemap was deleted.', array('%sitemap' => $uri['url'])));
   $form_state['redirect'] = 'admin/config/search/xmlsitemap';
 }
 
diff --git a/xmlsitemap.generate.inc b/xmlsitemap.generate.inc
index 8d5df35a7b9c89c21c130242ae181c895dea431f..23fba544be7d9a37f51940f4f6ffc412317ca1a6 100644
--- a/xmlsitemap.generate.inc
+++ b/xmlsitemap.generate.inc
@@ -190,7 +190,6 @@ function xmlsitemap_generate(array $sitemap, $chunk) {
   return $status;
 }
 
-
 /**
  * Write the proper XML sitemap header.
  *
@@ -308,7 +307,6 @@ function xmlsitemap_generate_chunk(array $sitemap, $handle, &$status, $chunk) {
     }
     $link_output .= '</url>' . PHP_EOL;
     $status &= (bool) fwrite($handle, $link_output);
-
   }
 
   // Close the XML file.
diff --git a/xmlsitemap.install b/xmlsitemap.install
index 4206c08bc208de3cb501f8af15add5326ace8d3b..2b90f17b77a9903ceff68085af5c46d23a4a42f9 100644
--- a/xmlsitemap.install
+++ b/xmlsitemap.install
@@ -353,226 +353,17 @@ function xmlsitemap_schema() {
   return $schema;
 }
 
-// @todo Remove these update functions before alpha.
-function xmlsitemap_update_1() {
-  db_drop_unique_key('xmlsitemap', 'loc');
-}
-
-function xmlsitemap_update_2() {
-  if (!variable_get('xmlsitemap_base_url', '')) {
-    variable_set('xmlsitemap_base_url', $GLOBALS['base_url']);
-  }
-}
-
-function xmlsitemap_update_3() {
-  db_add_index('xmlsitemap', 'loc', array('loc'));
-}
-
-function xmlsitemap_update_4() {
-  $field = array(
-    'type' => 'int',
-    'size' => 'tiny',
-    'default' => 1,
-    'unsigned' => TRUE,
-  );
-  db_change_field('xmlsitemap', 'status', 'status', $field);
-  db_add_index('xmlsitemap', 'status', array('status'));
-}
-
-function xmlsitemap_update_5() {
-  db_drop_primary_key('xmlsitemap');
-  db_add_primary_key('xmlsitemap', array('id', 'type'));
-}
-
-function xmlsitemap_update_6() {
-  if (db_field_exists('xmlsitemap', 'language')) {
-    db_drop_index('xmlsitemap', 'language');
-    db_drop_field('xmlsitemap', 'language');
-  }
-  variable_set('xmlsitemap_generated_last', variable_get('xmlsitemap_regenerate_last', 0));
-  variable_del('xmlsitemap_regenerate_last');
-}
-
-function xmlsitemap_update_7() {
-  if (db_query_range("SELECT 1 FROM {xmlsitemap} WHERE type = 'custom'", 0, 1)->fetchField()) {
-    drupal_install_modules(array('xmlsitemap_custom'));
-  }
-  variable_del('xmlsitemap_custom_links');
-}
-
-function xmlsitemap_update_8() {
-  $field = array(
-    'type' => 'float',
-    'default' => NULL,
-  );
-  db_add_field('xmlsitemap', 'priority_override', $field);
-}
-
-function xmlsitemap_update_9() {
-  $field = array(
-    'type' => 'int',
-    'default' => 0,
-    'unsigned' => TRUE,
-    'not null' => TRUE,
-  );
-  db_change_field('xmlsitemap', 'lastmod', 'lastmod', $field);
-}
-
-function xmlsitemap_update_10() {
-  db_update('system')
-    ->fields(array('weight' => 1))
-    ->condition('type', 'module')
-    ->condition('name', 'xmlsitemap')
-    ->execute();
-}
-
-function xmlsitemap_update_11() {
-  // Delete any items with NULL status and drop the status index.
-  db_delete('xmlsitemap')
-    ->isNull('status')
-    ->execute();
-  db_drop_index('xmlsitemap', 'status');
-
-  // Rename status to access.
-  $field = array(
-    'type' => 'int',
-    'size' => 'tiny',
-    'default' => 1,
-    'unsigned' => TRUE,
-    'not null' => TRUE,
-  );
-  db_change_field('xmlsitemap', 'status', 'access', $field);
-
-  // Add a status field.
-  $field = array(
-    'type' => 'int',
-    'size' => 'tiny',
-    'default' => 1,
-  );
-  db_add_field('xmlsitemap', 'status', $field);
-
-  db_add_index('xmlsitemap', 'access_status', array('access', 'status'));
-}
-
-function xmlsitemap_update_12() {
-  db_drop_index('xmlsitemap', 'access_status');
-  db_add_index('xmlsitemap', 'access_status_loc', array('access', 'status', 'loc'));
-}
-
-function xmlsitemap_update_13() {
-  db_change_field('xmlsitemap', 'priority_override', 'priority_override_value', array('type' => 'float', 'default' => NULL));
-  $override_field = array(
-    'type' => 'int',
-    'size' => 'tiny',
-    'default' => 0,
-    'not null' => TRUE,
-  );
-  db_add_field('xmlsitemap', 'status_override', $override_field);
-  db_add_field('xmlsitemap', 'priority_override', $override_field);
-
-  db_update('xmlsitemap')
-    ->fields(array('priority_override' => 1))
-    ->expression('priority', 'priority_override_value')
-    ->isNotNull('priority_override_value')
-    ->execute();
-  db_update('xmlsitemap')
-    ->fields(array('priority' => 0.5))
-    ->isNull('priority_override_value')
-    ->execute();
-  db_drop_field('xmlsitemap', 'priority_override_value');
-}
-
-function xmlsitemap_update_14() {
-  db_add_field('xmlsitemap', 'subtype', array('type' => 'varchar', 'length' => 32, 'default' => NULL));
-  $fields = array('node' => 'node_type', 'menu' => 'menu_name', 'taxonomy' => 'term_vid');
-  foreach ($fields as $type => $field) {
-    if (db_field_exists('xmlsitemap', $field)) {
-      db_update('xmlsitemap')
-        ->fields(array('subtype', $field))
-        ->condition('type', $type)
-        ->execute();
-      db_drop_index('xmlsitemap', $field);
-      db_drop_field('xmlsitemap', $field);
-    }
-  }
-  db_add_index('xmlsitemap', 'type_subtype', array('type', 'subtype'));
-}
-
-function xmlsitemap_update_15() {
-  $or = db_or();
-  $or->isNull('status');
-  $or->isNull('access');
-  db_delete('xmlsitemap')
-    ->condition($or)
-    ->execute();
-  $field = array(
-    'type' => 'int',
-    'size' => 'tiny',
-    'default' => 1,
-    'not null' => TRUE,
-  );
-  db_change_field('xmlsitemap', 'access', 'access', $field);
-  db_change_field('xmlsitemap', 'status', 'status', $field);
-}
-
-function xmlsitemap_update_16() {
-  $field = array(
-    'type' => 'varchar',
-    'length' => 12,
-    'not null' => TRUE,
-    'default' => '',
-  );
-  db_add_field('xmlsitemap', 'language', $field);
-  db_add_index('xmlsitemap', 'language', array('language'));
-}
-
-function xmlsitemap_update_17() {
-  db_update('xmlsitemap')
-    ->fields(array('access' => 1))
-    ->condition('access', 1, '>')
-    ->execute();
-  db_update('xmlsitemap')
-    ->fields(array('status' => 1))
-    ->condition('status', 1, '>')
-    ->execute();
-}
-
-function xmlsitemap_update_18() {
-  db_update('xmlsitemap')
-    ->fields(array('subtype' => ''))
-    ->isNull('subtype')
-    ->execute();
-  $field = array(
-    'type' => 'varchar',
-    'length' => 32,
-    'not null' => TRUE,
-    'default' => '',
-  );
-  db_change_field('xmlsitemap', 'type', 'type', $field);
-  $field['length'] = 128;
-  db_change_field('xmlsitemap', 'subtype', 'subtype', $field);
-}
-
 /**
- * Empty update.
+ * Implements hook_update_last_removed().
  */
-function xmlsitemap_update_6200() {
-}
-
-/**
- * Update empty string languages to LANGUAGE_NONE.
- */
-function xmlsitemap_update_7200() {
-  db_update('xmlsitemap')
-    ->fields(array('language' => LANGUAGE_NONE))
-    ->condition('language', '')
-    ->execute();
+function xmlsitemap_update_last_removed() {
+  return 6201;
 }
 
 /**
  * Create the {xmlsitemap_sitemap} table.
  */
-function xmlsitemap_update_7201() {
+function xmlsitemap_update_6202() {
   if (db_table_exists('xmlsitemap_sitemap')) {
     return;
   }
@@ -622,3 +413,13 @@ function xmlsitemap_update_7201() {
   );
   db_create_table('xmlsitemap_sitemap', $schema['xmlsitemap_sitemap']);
 }
+
+/**
+ * Update empty string languages to LANGUAGE_NONE.
+ */
+function xmlsitemap_update_7200() {
+  db_update('xmlsitemap')
+    ->fields(array('language' => LANGUAGE_NONE))
+    ->condition('language', '')
+    ->execute();
+}
diff --git a/xmlsitemap.module b/xmlsitemap.module
index fc7da6f3528d81069e528bff23e5e71b74837d14..1ba771447f5d012f79b6e37a41310f82e1ff1e61 100644
--- a/xmlsitemap.module
+++ b/xmlsitemap.module
@@ -151,6 +151,7 @@ function xmlsitemap_sitemap_uri(array $sitemap) {
     'absolute' => TRUE,
     'base_url' => xmlsitemap_var('base_url'),
   );
+  $uri['url'] = url($uri['path'], $uri['options']);
   return $uri;
 }
 
@@ -170,6 +171,7 @@ function xmlsitemap_sitemap_delete($smid) {
   db_delete('xmlsitemap_sitemap')
     ->condition('smid', $smid)
     ->execute();
+  // @todo Delete context files.
 }
 
 /**
@@ -286,7 +288,7 @@ function xmlsitemap_robotstxt() {
   $context = xmlsitemap_get_current_context();
   if ($sitemap = xmlsitemap_sitemap_load_by_context($context)) {
     $uri = xmlsitemap_sitemap_uri($sitemap);
-    $robotstxt[] = 'Sitemap: ' . url($uri['path'], $uri['options']);
+    $robotstxt[] = 'Sitemap: ' . $uri['url'];
     return $robotstxt;
   }
 }
diff --git a/xmlsitemap.xmlsitemap.inc b/xmlsitemap.xmlsitemap.inc
index 0bbfe4b8bc3a015b61cb57396f5568c343227170..b4ac5f0058f8d9db467b4abed7cc9d141b11410f 100644
--- a/xmlsitemap.xmlsitemap.inc
+++ b/xmlsitemap.xmlsitemap.inc
@@ -19,7 +19,7 @@ function xmlsitemap_xmlsitemap_link_info() {
  * XML sitemap link type settings callback for frontpage link entity.
  */
 function xmlsitemap_link_frontpage_settings(&$form) {
-  module_load_include('inc', 'xmlsitemap', 'xmlsitemap.admin');
+  module_load_include('admin.inc', 'xmlsitemap');
   if (user_access('administer site configuration')) {
     $form['#description'] = t('The front page path can be changed at <a href="@url-frontpage">@url-frontpage</a>.', array('@url-frontpage' => url('admin/settings/site-information')));
   }
diff --git a/xmlsitemap_engines/xmlsitemap_engines.install b/xmlsitemap_engines/xmlsitemap_engines.install
index 746f0212561eb5878d726e3d9e2f099a021edce1..ada15f4fc8e84040fda75526a944895b5c031695 100644
--- a/xmlsitemap_engines/xmlsitemap_engines.install
+++ b/xmlsitemap_engines/xmlsitemap_engines.install
@@ -31,45 +31,8 @@ function xmlsitemap_engines_uninstall() {
 }
 
 /**
- * Filter the xmlsitemap_engines_submit variable.
+ * Implements hook_update_last_removed().
  */
-function xmlsitemap_engines_update_1() {
-  variable_set('xmlsitemap_engines_submit', array_filter(variable_get('xmlsitemap_engines_submit', array())));
-}
-
-/**
- * Rename the xmlsitemap_engines_engines variable to xmlsitemap_engines_submit.
- */
-function xmlsitemap_engines_update_2() {
-  variable_set('xmlsitemap_engines_engines', variable_get('xmlsitemap_engines_submit', array()));
-  variable_del('xmlsitemap_engines_submit');
-}
-
-/**
- * Increase the module weight so it always runs after sitemap generation.
- */
-function xmlsitemap_engines_update_3() {
-  db_update('system')
-    ->fields(array('weight' => 2))
-    ->condition('type', 'module')
-    ->condition('name', 'xmlsitemap_engines')
-    ->execute();
-}
-
-/**
- * Update Windows Live search to Bing.
- */
-function xmlsitemap_engines_update_4() {
-  $engines = variable_get('xmlsitemap_engines_engines', array());
-  $index = array_search('windows_live', $engines);
-  if ($index !== FALSE) {
-    $engines[$index] = 'bing';
-  }
-  variable_set('xmlsitemap_engines_engines', $engines);
-}
-
-/**
- * Empty update.
- */
-function xmlsitemap_engines_update_6200() {
+function xmlsitemap_engines_update_last_removed() {
+  return 6201;
 }
diff --git a/xmlsitemap_engines/xmlsitemap_engines.module b/xmlsitemap_engines/xmlsitemap_engines.module
index 14dac1a3e4c8f3d3382af89c5e74dd9b1feb2330..21dabed6a4dbea14a871b6b1a147cab0ddd80001 100644
--- a/xmlsitemap_engines/xmlsitemap_engines.module
+++ b/xmlsitemap_engines/xmlsitemap_engines.module
@@ -140,7 +140,8 @@ function xmlsitemap_engines_submit_engines(array $smids = array()) {
  */
 function xmlsitemap_engines_submit_sitemaps($url, array $sitemaps = array()) {
   foreach ($sitemaps as $sitemap) {
-    $submit_url = xmlsitemap_engines_prepare_url($url, $sitemap);
+    $sitemap_url = xmlsitemap_sitemap_uri($sitemap);
+    $submit_url = xmlsitemap_engines_prepare_url($url, $sitemap_url['url']);
     $request = drupal_http_request($submit_url);
     watchdog('xmlsitemap', 'Submitted the sitemap to %url and received response @code.', array('%url' => $submit_url, '@code' => $request->code));
   }
diff --git a/xmlsitemap_i18n/xmlsitemap_i18n.module b/xmlsitemap_i18n/xmlsitemap_i18n.module
index 9b93d0f9c29771ddf434e99ed07d4fa521e6075a..7ad952f8076f204f16d655fe232845c813963b50 100644
--- a/xmlsitemap_i18n/xmlsitemap_i18n.module
+++ b/xmlsitemap_i18n/xmlsitemap_i18n.module
@@ -1,6 +1,18 @@
 <?php
 // $Id$
 
+/**
+ * Implements hook_xmlsitemap_context_info().
+ */
+function xmlsitemap_i18n_xmlsitemap_context_info() {
+  $context['language'] = array(
+    'label' => t('Language'),
+    'summary callback' => 'locale_language_name',
+    'settings callback' => 'xmlsitemap_i18n_xmlsitemap_language_context_settings',
+  );
+  return $context;
+}
+
 /**
  * Implements hook_xmlsitemap_context().
  */
@@ -11,17 +23,6 @@ function xmlsitemap_i18n_xmlsitemap_context() {
   return $context;
 }
 
-/**
- * Implements xmlsitemap_context_url_options().
- */
-function xmlsitemap_i18n_xmlsitemap_context_url_options(array $context) {
-  $options = array();
-  if (isset($context['language'])) {
-    $options['language'] = xmlsitemap_language_load($context['language']);
-  }
-  return $options;
-}
-
 /**
  * Implements hook_xmlsitemap_context_fallback().
  */
@@ -31,15 +32,14 @@ function xmlsitemap_i18n_xmlsitemap_context_fallback() {
 }
 
 /**
- * Implements hook_xmlsitemap_context_info().
+ * Implements xmlsitemap_context_url_options().
  */
-function xmlsitemap_i18n_xmlsitemap_context_info() {
-  $context['language'] = array(
-    'label' => t('Language'),
-    'summary callback' => 'locale_language_name',
-    'settings callback' => 'xmlsitemap_i18n_xmlsitemap_language_context_settings',
-  );
-  return $context;
+function xmlsitemap_i18n_xmlsitemap_context_url_options(array $context) {
+  $options = array();
+  if (isset($context['language'])) {
+    $options['language'] = xmlsitemap_language_load($context['language']);
+  }
+  return $options;
 }
 
 /**
@@ -54,6 +54,15 @@ function xmlsitemap_i18n_form_xmlsitemap_sitemap_edit_form_alter(&$form, $form_s
   );
 }
 
+/**
+ * Implements hook_form_FORM_ID_alter().
+ *
+ * Set the regeneration needed flag if settings are changed.
+ */
+function xmlsitemap_form_locale_languages_overview_form_alter(&$form, $form_state) {
+  array_unshift($form['#submit'], 'xmlsitemap_form_submit_flag_regenerate');
+}
+
 /**
  * Implements hook_form_FORM_ID_alter().
  *
@@ -116,12 +125,3 @@ function xmlsitemap_i18n_query_xmlsitemap_alter(QueryAlterableInterface $query)
       break;
   }
 }
-
-/**
- * Implements hook_form_FORM_ID_alter().
- *
- * Set the regeneration needed flag if settings are changed.
- */
-function xmlsitemap_form_locale_languages_overview_form_alter(&$form, $form_state) {
-  array_unshift($form['#submit'], 'xmlsitemap_form_submit_flag_regenerate');
-}