diff -ruN xmlsitemap/docs/xmlsitemap.php xmlsitemap.new/docs/xmlsitemap.php
--- xmlsitemap/docs/xmlsitemap.php	2007-12-06 18:41:14.000000000 +0100
+++ xmlsitemap.new/docs/xmlsitemap.php	2008-04-14 19:36:28.000000000 +0200
@@ -173,10 +173,10 @@
       if (variable_get('xmlsitemap_engines_google_submit', TRUE)) {
         $result = drupal_http_request(variable_get('xmlsitemap_engines_google_url', 'http://www.google.com/webmasters/tools/ping?sitemap='. xmlsitemap_url('sitemap.xml', drupal_lookup_path('alias', 'sitemap.xml') ? drupal_lookup_path('alias', 'sitemap.xml') : NULL, NULL, NULL, TRUE)));
         if ($result->code == 200) {
-          watchdog('xmlsitemap', t('Sitemap successfully submitted to Google.'));
+          watchdog('xmlsitemap', 'Sitemap successfully submitted to Google.');
         }
         else {
-          watchdog('xmlsitemap', t('Error occurred submitting sitemap to Google: @code', array('@code' => $result->code)), WATCHDOG_ERROR);
+          watchdog('xmlsitemap', 'Error occurred submitting sitemap to Google: @code', array('@code' => $result->code), WATCHDOG_ERROR);
         }
       }
       break;
diff -ruN xmlsitemap/xmlsitemap_engines/xmlsitemap_engines.info xmlsitemap.new/xmlsitemap_engines/xmlsitemap_engines.info
--- xmlsitemap/xmlsitemap_engines/xmlsitemap_engines.info	2008-01-21 01:15:00.000000000 +0100
+++ xmlsitemap.new/xmlsitemap_engines/xmlsitemap_engines.info	2008-04-14 19:38:14.000000000 +0200
@@ -1,13 +1,14 @@
-; $Id: xmlsitemap_engines.info,v 1.1 2007/11/09 17:56:05 darrenoh Exp $
-name = XML Sitemap: Engines
-description = Submits site map to search engines.
-package = XML Sitemap
-dependencies = xmlsitemap
-
-
-; Information added by drupal.org packaging script on 2008-01-21
-version = "6.x-0.x-dev"
-core = "6.x"
-project = "xmlsitemap"
-datestamp = "1200874500"
-
+; $Id: xmlsitemap_engines.info,v 1.1 2007/11/09 17:56:05 darrenoh Exp $
+name = XML Sitemap: Engines
+description = Submits site map to search engines.
+package = XML Sitemap
+dependencies[] = xmlsitemap
+core = 6.x
+version = 6.x-1.x-dev
+
+
+; Information added by drupal.org packaging script on 2008-01-21
+version = "6.x-0.x-dev"
+core = "6.x"
+project = "xmlsitemap"
+datestamp = "1200874500"
diff -ruN xmlsitemap/xmlsitemap_engines/xmlsitemap_engines.module xmlsitemap.new/xmlsitemap_engines/xmlsitemap_engines.module
--- xmlsitemap/xmlsitemap_engines/xmlsitemap_engines.module	2007-12-13 03:48:02.000000000 +0100
+++ xmlsitemap.new/xmlsitemap_engines/xmlsitemap_engines.module	2008-04-14 19:36:28.000000000 +0200
@@ -64,10 +64,10 @@
       if (variable_get('xmlsitemap_engines_google_submit', FALSE)) {
         $result = drupal_http_request(variable_get('xmlsitemap_engines_google_url', 'http://www.google.com/webmasters/tools/ping?sitemap='. xmlsitemap_url('sitemap.xml', drupal_lookup_path('alias', 'sitemap.xml') ? drupal_lookup_path('alias', 'sitemap.xml') : NULL, NULL, NULL, TRUE)));
         if ($result->code == 200) {
-          watchdog('xmlsitemap', t('Sitemap successfully submitted to Google.'));
+          watchdog('xmlsitemap', 'Sitemap successfully submitted to Google.');
         }
         else {
-          watchdog('xmlsitemap', t('Error occurred submitting sitemap to Google: @code', array('@code' => $result->code)), WATCHDOG_ERROR);
+          watchdog('xmlsitemap', 'Error occurred submitting sitemap to Google: @code', array('@code' => $result->code), WATCHDOG_ERROR);
         }
       }
       break;
@@ -116,10 +116,10 @@
       if (variable_get('xmlsitemap_engines_yahoo_submit', FALSE)) {
         $result = drupal_http_request(variable_get('xmlsitemap_engines_yahoo_url', 'http://search.yahooapis.com/SiteExplorerService/V1/ping?sitemap='. xmlsitemap_url('sitemap.xml', drupal_lookup_path('alias', 'sitemap.xml') ? drupal_lookup_path('alias', 'sitemap.xml') : NULL, NULL, NULL, TRUE)));
         if ($result->code == 200) {
-          watchdog('xmlsitemap', t('Site map successfully submitted to Yahoo!.'));
+          watchdog('xmlsitemap', 'Site map successfully submitted to Yahoo!.');
         }
         else {
-          watchdog('xmlsitemap', t('Error occurred submitting site map to Yahoo!: @code', array('@code' => $result->code)), WATCHDOG_ERROR);
+          watchdog('xmlsitemap', 'Error occurred submitting site map to Yahoo!: @code', array('@code' => $result->code), WATCHDOG_ERROR);
         }
       }
       break;
@@ -154,10 +154,10 @@
       if (variable_get('xmlsitemap_engines_ask_submit', FALSE)) {
         $result = drupal_http_request(variable_get('xmlsitemap_engines_ask_url', 'http://submissions.ask.com/ping?sitemap='. xmlsitemap_url('sitemap.xml', drupal_lookup_path('alias', 'sitemap.xml') ? drupal_lookup_path('alias', 'sitemap.xml') : NULL, NULL, NULL, TRUE)));
         if ($result->code == 200) {
-          watchdog('xmlsitemap', t('Site map successfully submitted to Ask.com.'));
+          watchdog('xmlsitemap', 'Site map successfully submitted to Ask.com.');
         }
         else {
-          watchdog('xmlsitemap', t('Error occurred submitting site map to Ask.com: @code', array('@code' => $result->code)), WATCHDOG_ERROR);
+          watchdog('xmlsitemap', 'Error occurred submitting site map to Ask.com: @code', array('@code' => $result->code), WATCHDOG_ERROR);
         }
       }
       break;
@@ -204,10 +204,10 @@
       if (variable_get('xmlsitemap_engines_live_submit', FALSE)) {
         $result = drupal_http_request(variable_get('xmlsitemap_engines_live_url', 'http://webmaster.live.com/ping.aspx?siteMap='. xmlsitemap_url('sitemap.xml', drupal_lookup_path('alias', 'sitemap.xml') ? drupal_lookup_path('alias', 'sitemap.xml') : NULL, NULL, NULL, TRUE)));
         if ($result->code == 200) {
-          watchdog('xmlsitemap', t('Site map successfully submitted to Windows Live.'));
+          watchdog('xmlsitemap', 'Site map successfully submitted to Windows Live.');
         }
         else {
-          watchdog('xmlsitemap', t('Error occurred submitting site map to Windows Live: @code', array('@code' => $result->code)), WATCHDOG_ERROR);
+          watchdog('xmlsitemap', 'Error occurred submitting site map to Windows Live: @code', array('@code' => $result->code), WATCHDOG_ERROR);
         }
       }
       break;
@@ -217,41 +217,37 @@
 /**
  * Implementation of hook_menu().
  */
-function xmlsitemap_engines_menu($may_cache) {
+function xmlsitemap_engines_menu() {
   $items = array();
-  $access_content = user_access('access content');
-  if ($may_cache) {
-    if ($verify = variable_get('xmlsitemap_engines_google_verify', '')) {
-      $items[] = array(
-        'path' => $verify,
-        'title' => t('Google verification page'),
-        'callback' => '_xmlsitemap_engines_verify',
-        'callback arguments' => array('google'),
-        'type' => MENU_CALLBACK,
-        'access' => $access_content,
-      );
-    }
-    if (($verify = variable_get('xmlsitemap_engines_yahoo_verify', '')) != '') {
-      $items[] = array(
-        'path' => $verify,
-        'title' => t('Yahoo! verification page'),
-        'callback' => '_xmlsitemap_engines_verify',
-        'callback arguments' => array('yahoo'),
-        'type' => MENU_CALLBACK,
-        'access' => $access_content,
-      );
-    }
-    if (($verify = variable_get('xmlsitemap_engines_live_verify', 'LiveSearchSiteAuth.xml')) != '') {
-      $items[] = array(
-        'path' => $verify,
-        'title' => t('Windows Live verification page'),
-        'callback' => '_xmlsitemap_engines_verify',
-        'callback arguments' => array('live'),
-        'type' => MENU_CALLBACK,
-        'access' => $access_content,
-      );
-    }
+  $access_content = array('access content');
+  if ($verify = variable_get('xmlsitemap_engines_google_verify', '')) {
+    $items[$verify] = array(
+      'title' => 'Google verification page',
+      'page callback' => '_xmlsitemap_engines_verify',
+      'page arguments' => array('google'),
+      'type' => MENU_CALLBACK,
+      'access arguments' => $access_content,
+    );
+  }
+  if (($verify = variable_get('xmlsitemap_engines_yahoo_verify', '')) != '') {
+    $items[$verify] = array(
+      'title' => 'Yahoo! verification page',
+      'page callback' => '_xmlsitemap_engines_verify',
+      'page arguments' => array('yahoo'),
+      'type' => MENU_CALLBACK,
+      'access arguments' => $access_content,
+    );
+  }
+  if (($verify = variable_get('xmlsitemap_engines_live_verify', 'LiveSearchSiteAuth.xml')) != '') {
+    $items[$verify] = array(
+      'title' => 'Windows Live verification page',
+      'page callback' => '_xmlsitemap_engines_verify',
+      'page arguments' => array('live'),
+      'type' => MENU_CALLBACK,
+      'access arguments' => $access_content,
+    );
   }
+ 
   return $items;
 }
 
diff -ruN xmlsitemap/xmlsitemap.info xmlsitemap.new/xmlsitemap.info
--- xmlsitemap/xmlsitemap.info	2008-01-21 01:15:00.000000000 +0100
+++ xmlsitemap.new/xmlsitemap.info	2008-04-14 19:36:28.000000000 +0200
@@ -1,12 +1,11 @@
-; $Id: xmlsitemap.info,v 1.1 2007/11/09 17:56:04 darrenoh Exp $
-name = XML Sitemap
-description = Creates an XML site map in accordance with the sitemaps.org specification.
-package = XML Sitemap
-
-
-; Information added by drupal.org packaging script on 2008-01-21
-version = "6.x-0.x-dev"
-core = "6.x"
-project = "xmlsitemap"
-datestamp = "1200874500"
-
+; $Id: xmlsitemap.info,v 1.1 2007/11/09 17:56:04 darrenoh Exp $
+name = XML Sitemap
+description = Creates an XML site map in accordance with the sitemaps.org specification.
+package = XML Sitemap
+
+
+; Information added by drupal.org packaging script on 2008-01-21
+version = "6.x-1.x-dev"
+core = "6.x"
+project = "xmlsitemap"
+datestamp = "1200874500"
diff -ruN xmlsitemap/xmlsitemap.install xmlsitemap.new/xmlsitemap.install
--- xmlsitemap/xmlsitemap.install	2007-12-11 23:57:45.000000000 +0100
+++ xmlsitemap.new/xmlsitemap.install	2008-04-14 19:36:28.000000000 +0200
@@ -2,33 +2,74 @@
 // $Id: xmlsitemap.install,v 1.4 2007/12/11 22:57:45 darrenoh Exp $
 
 /**
+ * Implementation of hook_schema().
+ */
+function xmlsitemap_schema() {
+  $schema['xmlsitemap_additional'] = array(
+    'description' => t('The base table for xmlsitemap.'),
+    'fields' => array(
+      'path' => array(
+        'description' => t('The path of this node.'),
+        'type' => 'varchar',
+        'length' => 128,
+        'not null' => TRUE,
+        'default' => '',
+      ),
+      'pid' => array(
+        'description' => t('The id of the path.'),
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'last_changed' => array(
+        'description' => t('Keeps track of new changes.'),
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'previously_changed' => array(
+        'description' => t('Keeps track of old changes.'),
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'priority' => array(
+        'description' => t('Stores the index value.'),
+        'type' => 'float',
+        'not null' => FALSE,
+      ),
+    ),
+    'indexes' => array(
+      'pid' => array('pid'),
+    ),
+    'primary key' => array('path'),
+  );
+
+  return $schema;
+}
+
+/**
  * Implementation of hook_install().
  */
 function xmlsitemap_install() {
-  switch ($GLOBALS['db_type']) {
-    case 'mysql':
-    case 'mysqli':
-      db_query("CREATE TABLE {xmlsitemap_additional} (
-        path varchar(128) NOT NULL default '',
-        pid int,
-        last_changed int(11),
-        previously_changed int(11),
-        priority float,
-        PRIMARY KEY (path)
-      ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
-      break;
-    case 'pgsql':
-      db_query("CREATE TABLE {xmlsitemap_additional} (
-        path varchar(128) NOT NULL default '',
-        pid integer,
-        last_changed integer,
-        previously_changed integer,
-        priority real,
-        PRIMARY KEY (path)
-      );");
-      break;
-  }
+  // Create my tables.
   db_query("DELETE FROM {url_alias} WHERE dst LIKE 'sitemap%.xml'");
+  drupal_install_schema('xmlsitemap');
+}
+
+/**
+ * Implementation of hook_uninstall().
+ */
+function xmlsitemap_uninstall() {
+  // Drop my tables.
+  $settings = db_query("SELECT name FROM {variable} WHERE name LIKE 'xmlsitemap\_%'");
+  while ($variable = db_fetch_object($settings)) {
+    variable_del($variable->name);
+  }
+  drupal_uninstall_schema('xmlsitemap');
 }
 
 /**
@@ -66,15 +107,3 @@
     rmdir($path);
   }
 }
-
-/**
- * Implementation of hook_uninstall().
- */
-function xmlsitemap_uninstall() {
-  db_query("DROP TABLE {xmlsitemap_additional}");
-  $settings = db_query("SELECT name FROM {variable} WHERE name LIKE 'xmlsitemap\_%'");
-  while ($variable = db_fetch_object($settings)) {
-    variable_del($variable->name);
-  }
-}
-
diff -ruN xmlsitemap/xmlsitemap.module xmlsitemap.new/xmlsitemap.module
--- xmlsitemap/xmlsitemap.module	2007-12-18 23:54:51.000000000 +0100
+++ xmlsitemap.new/xmlsitemap.module	2008-04-14 19:36:28.000000000 +0200
@@ -8,8 +8,8 @@
 /**
  * Implementation of hook_help().
  */
-function xmlsitemap_help($section) {
-  switch ($section) {
+function xmlsitemap_help($path, $arg) {
+  switch ($path) {
     case 'admin/settings/xmlsitemap':
     case 'admin/settings/xmlsitemap/settings':
       return t('Configure the site map. Your site map is at !url.', array('!url' => '<a href="'. xmlsitemap_url('sitemap.xml', drupal_lookup_path('alias', 'sitemap.xml') ? drupal_lookup_path('alias', 'sitemap.xml') : NULL, NULL, NULL, TRUE) .'">'. xmlsitemap_url('sitemap.xml', drupal_lookup_path('alias', 'sitemap.xml') ? drupal_lookup_path('alias', 'sitemap.xml') : NULL, NULL, NULL, TRUE) .'</a>'));
@@ -23,64 +23,58 @@
 /**
  * Implementation of hook_menu().
  */
-function xmlsitemap_menu($may_cache) {
+function xmlsitemap_menu() {
   $items = array();
-  $access_config = user_access('administer site configuration');
-  $access_content = user_access('access content');
-  if ($may_cache) {
-    $items[] = array(
-      'path' => 'admin/settings/xmlsitemap',
-      'title' => t('XML Sitemap'),
-      'description' => t('Configure site map.'),
-      'callback' => 'drupal_get_form',
-      'callback arguments' => array('xmlsitemap_settings_sitemap'),
-      'access' => $access_config,
-    );
-    $items[] = array(
-      'path' => 'admin/settings/xmlsitemap/settings',
-      'title' => t('Site map'),
-      'description' => t('Configure site map.'),
-      'type' => MENU_DEFAULT_LOCAL_TASK,
-      'weight' => -1,
-    );
-    $items[] = array(
-      'path' => 'admin/settings/xmlsitemap/engines',
-      'title' => t('Search engines'),
-      'description' => t('Configure search engines.'),
-      'callback' => 'drupal_get_form',
-      'callback arguments' => array('xmlsitemap_settings_engines'),
-      'type' => MENU_LOCAL_TASK,
-    );
-    $items[] = array(
-      'path' => 'admin/settings/xmlsitemap/additional',
-      'title' => t('Additional'),
-      'description' => t('Configure additional links.'),
-      'callback' => 'drupal_get_form',
-      'callback arguments' => array('xmlsitemap_settings_additional'),
-      'type' => MENU_LOCAL_TASK,
-      'weight' => 1,
-    );
-    $items[] = array(
-      'path' => 'sitemap.xml',
-      'title' => t('Site map index'),
-      'callback' => '_xmlsitemap_output',
+  $access_config = array('administer site configuration');
+  $access_content = array('access content');
+  $items['admin/settings/xmlsitemap'] = array(
+    'title' => 'XML Sitemap',
+    'description' => 'Configure site map.',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('xmlsitemap_settings_sitemap'),
+    'access arguments' => $access_config,
+  );
+  $items['admin/settings/xmlsitemap/settings'] = array(
+    'title' => 'Site map',
+    'description' => 'Configure site map.',
+    'type' => MENU_DEFAULT_LOCAL_TASK,
+    'weight' => -1,
+  );
+  $items['admin/settings/xmlsitemap/engines'] = array(
+    'title' => 'Search engines',
+    'description' => 'Configure search engines.',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('xmlsitemap_settings_engines'),
+    'type' => MENU_LOCAL_TASK,
+    'access arguments' => $access_config,
+  );
+  $items['admin/settings/xmlsitemap/additional'] = array(
+    'title' => 'Additional',
+    'description' => 'Configure additional links.',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('xmlsitemap_settings_additional'),
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 1,
+    'access arguments' => $access_config,
+
+  );
+  $items['sitemap.xml'] = array(
+    'title' => 'Site map index',
+    'page callback' => '_xmlsitemap_output',
+    'type' => MENU_CALLBACK,
+    'access arguments' => $access_content
+  );
+  $chunk_count = variable_get('xmlsitemap_chunk_count', 0);
+  for ($chunk = 0; $chunk < $chunk_count; ++$chunk) {
+    $items["sitemap$chunk.xml"] = array(
+      'title' => 'Site map !number', array('!number' => $chunk),
+      'page callback' => '_xmlsitemap_output',
+      'page arguments' => array($chunk),
       'type' => MENU_CALLBACK,
-      'access' => $access_content,
+      'access arguments' => $access_content
     );
   }
-  else {
-    $chunk_count = variable_get('xmlsitemap_chunk_count', 0);
-    for ($chunk = 0; $chunk < $chunk_count; ++$chunk) {
-      $items[] = array(
-        'path' => "sitemap$chunk.xml",
-        'title' => t('Site map !number', array('!number' => $chunk)),
-        'callback' => '_xmlsitemap_output',
-        'callback arguments' => array($chunk),
-        'type' => MENU_CALLBACK,
-        'access' => $access_content,
-      );
-    }
-  }
+
   return $items;
 }
 
@@ -111,8 +105,8 @@
 /**
  * Validate site map settings form.
  */
-function xmlsitemap_settings_sitemap_validate($form_id, $form_values) {
-  if ($form_values['xmlsitemap_chunk_size'] > 50000) {
+function xmlsitemap_settings_sitemap_validate($form, &$form_state) {
+  if ($form_state['values']['xmlsitemap_chunk_size'] > 50000) {
     form_set_error('xmlsitemap_chunk_size', t('Cannot send more than 50,000 links at one time.'));
   }
 }
@@ -120,8 +114,8 @@
 /**
  * Submit site map settings form.
  */
-function xmlsitemap_settings_sitemap_submit($form_id, $form_values) {
-  system_settings_form_submit($form_id, $form_values);
+function xmlsitemap_settings_sitemap_submit($form, &$form_state) {
+  system_settings_form_submit($form, $form_state['values']);
   xmlsitemap_update_sitemap();
 }
 
@@ -159,12 +153,12 @@
 /**
  * Submit search engine settings form.
  */
-function xmlsitemap_settings_engines_submit($form_id, $form_values) {
-  if ($form_values['xmlsitemap_root']) {
-    $form_values['xmlsitemap_submit'] = FALSE;
-    $form_values['xmlsitemap_log_access'] = FALSE;
+function xmlsitemap_settings_engines_submit($form, &$form_state) {
+  if ($form_state['values']['xmlsitemap_root']) {
+    $form_state['values']['xmlsitemap_submit'] = FALSE;
+    $form_state['values']['xmlsitemap_log_access'] = FALSE;
   }
-  system_settings_form_submit($form_id, $form_values);
+  system_settings_form_submit($form, $form_state);
 }
 
 /**
@@ -210,6 +204,16 @@
 }
 
 /**
+ * Implementation of hook_theme().
+ */
+function xmlsitemap_theme() {
+  return array(
+    'xmlsitemap_settings_additional' => array(
+    ),
+  );
+}
+
+/**
  * Theme additional links form.
  * @ingroup themeable
  */
@@ -232,56 +236,57 @@
   return $output;
 }
 
+
 /**
  * Submit additional links form.
  */
-function xmlsitemap_settings_additional_submit($form_id, $form_values) {
+function xmlsitemap_settings_additional_submit($form, &$form_state) {
   $update = FALSE;
-  if ($form_values['op'] == t('Save configuration')) {
-    if ($form_values['xmlsitemap_additional_links_priority'] != variable_get('xmlsitemap_additional_links_priority', 0.1)) {
+  if ($form_state['values']['op'] == t('Save configuration')) {
+    if ($form_state['values']['xmlsitemap_additional_links_priority'] != variable_get('xmlsitemap_additional_links_priority', 0.1)) {
       $update = TRUE;
     }
-    if (!empty($form_values['delete'])) {
-      foreach ($form_values['delete'] as $id => $delete) {
-        if ($delete || $form_values['path'][$id] == trim($form_values['link']['new'])) {
-          db_query("DELETE FROM {xmlsitemap_additional} WHERE path = '%s'", $form_values['path'][$id]);
-          unset($form_values['priority'][$id]);
+    if (!empty($form_state['values']['delete'])) {
+      foreach ($form_state['values']['delete'] as $id => $delete) {
+        if ($delete || $form_state['values']['path'][$id] == trim($form_state['values']['link']['new'])) {
+          db_query("DELETE FROM {xmlsitemap_additional} WHERE path = '%s'", $form_state['values']['path'][$id]);
+          unset($form_state['values']['priority'][$id]);
           $update = TRUE;
         }
       }
-      unset($form_values['delete']);
+      unset($form_state['values']['delete']);
     }
-    $path = trim($form_values['link']['new']);
+    $path = trim($form_state['values']['link']['new']);
     $pid = db_result(db_query("SELECT pid FROM {url_alias} WHERE src = '%s'", $path));
     if (!empty($path)) {
       db_query("
         INSERT INTO {xmlsitemap_additional} (path, pid, last_changed, priority) VALUES ('%s', %s, %d, %s)
-      ", $path, empty($pid) ? 'NULL' : $pid, time(), $form_values['priority']['new']);
-      unset($form_values['link'], $form_values['priority']['new']);
+      ", $path, empty($pid) ? 'NULL' : $pid, time(), $form_state['values']['priority']['new']);
+      unset($form_state['values']['link'], $form_state['values']['priority']['new']);
       $update = TRUE;
     }
-    if (!empty($form_values['priority'])) {
-      foreach ($form_values['priority'] as $id => $priority) {
-        if ($priority != $form_values['old_priority'][$id]) {
-          $pid = db_result(db_query("SELECT pid FROM {url_alias} WHERE src = '%s'", $form_values['path'][$id]));
+    if (!empty($form_state['values']['priority'])) {
+      foreach ($form_state['values']['priority'] as $id => $priority) {
+        if ($priority != $form_state['values']['old_priority'][$id]) {
+          $pid = db_result(db_query("SELECT pid FROM {url_alias} WHERE src = '%s'", $form_state['values']['path'][$id]));
           db_query("
             UPDATE {xmlsitemap_additional}
             SET pid = %s, previously_changed = last_changed, last_changed = %d, priority = %s
             WHERE path = '%s'
-          ", empty($pid) ? 'NULL' : $pid, time(), $priority, $form_values['path'][$id]);
+          ", empty($pid) ? 'NULL' : $pid, time(), $priority, $form_state['values']['path'][$id]);
           $update = TRUE;
         }
       }
-      unset($form_values['path'], $form_values['priority'], $form_values['old_priority']);
+      unset($form_state['values']['path'], $form_state['values']['priority'], $form_state['values']['old_priority']);
     }
   }
   elseif (variable_get('xmlsitemap_additional_links_priority', 0.1) != 0.1) {
-    if (in_array('NULL', $form_values['old_priority'])) {
+    if (in_array('NULL', $form_state['values']['old_priority'])) {
       $update = TRUE;
     }
-    unset($form_values['delete'], $form_values['path'], $form_values['link'], $form_values['old_priority'], $form_values['priority']);
+    unset($form_state['values']['delete'], $form_state['values']['path'], $form_state['values']['link'], $form_state['values']['old_priority'], $form_state['values']['priority']);
   }
-  system_settings_form_submit($form_id, $form_values);
+  system_settings_form_submit($form, $form_state);
   if ($update) {
     xmlsitemap_update_sitemap();
   }
@@ -360,7 +365,7 @@
       $message = isset($message) ? $message : t('!sitemap downloaded by @user-agent at @address.', array(
         '!sitemap' => $type,
         '@user-agent' => $_SERVER['HTTP_USER_AGENT'],
-        '@address' => $_SERVER['REMOTE_ADDR'],
+        '@address' => ip_address(),
       ));
       watchdog('xmlsitemap', $message);
     }
@@ -706,9 +711,11 @@
   $script = isset($script) ? $script : strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') === FALSE ? 'index.php' : '';
   $clean_url = isset($clean_url) ? $clean_url : variable_get('clean_url', FALSE);
   $base = ($absolute ? $base_url .'/' : base_path());
+
   if (!empty($path) && $path != '<front>') {
     $path = _xmlsitemap_get_path_alias($path, $alias);
     $path = drupal_urlencode($path);
+
     if (!$clean_url) {
       if (isset($query)) {
         return $base . $script .'?q='. $path .'&'. $query . $fragment;
@@ -750,9 +757,9 @@
   if (function_exists('custom_url_rewrite')) {
     $result = custom_url_rewrite('alias', $result, $path);
   }
-  if (module_exists('i18n')) {
-    i18n_get_lang_prefix($result, TRUE);
-  }
+#  if (module_exists('i18n')) {
+#    i18n_get_lang_prefix($result, TRUE);
+#  }
   return $result;
 }
 
diff -ruN xmlsitemap/xmlsitemap_node/xmlsitemap_node.info xmlsitemap.new/xmlsitemap_node/xmlsitemap_node.info
--- xmlsitemap/xmlsitemap_node/xmlsitemap_node.info	2008-01-21 01:15:00.000000000 +0100
+++ xmlsitemap.new/xmlsitemap_node/xmlsitemap_node.info	2008-04-14 19:36:28.000000000 +0200
@@ -1,13 +1,15 @@
-; $Id: xmlsitemap_node.info,v 1.1 2007/11/09 17:56:05 darrenoh Exp $
-name = XML Sitemap: Node
-description = Adds nodes to the site map.
-package = XML Sitemap
-dependencies = xmlsitemap
-
-
-; Information added by drupal.org packaging script on 2008-01-21
-version = "6.x-0.x-dev"
-core = "6.x"
-project = "xmlsitemap"
-datestamp = "1200874500"
-
+; $Id: xmlsitemap_node.info,v 1.1 2007/11/09 17:56:05 darrenoh Exp $
+name = XML Sitemap: Node
+description = Adds nodes to the site map.
+package = XML Sitemap
+dependencies[] = xmlsitemap
+core = 6.x
+version = 6.x-1.x-dev
+
+
+; Information added by drupal.org packaging script on 2008-03-10
+version = "6.x-0.x-dev"
+core = "6.x"
+project = "xmlsitemap"
+datestamp = "1200874500"
+
diff -ruN xmlsitemap/xmlsitemap_node/xmlsitemap_node.install xmlsitemap.new/xmlsitemap_node/xmlsitemap_node.install
--- xmlsitemap/xmlsitemap_node/xmlsitemap_node.install	2008-01-08 06:13:35.000000000 +0100
+++ xmlsitemap.new/xmlsitemap_node/xmlsitemap_node.install	2008-04-14 19:36:28.000000000 +0200
@@ -2,36 +2,87 @@
 // $Id: xmlsitemap_node.install,v 1.7 2008/01/08 05:13:35 darrenoh Exp $
 
 /**
+ * Implementation of hook_schema().
+ */
+function xmlsitemap_node_schema() {
+  $schema['xmlsitemap_node'] = array(
+    'description' => t('The base table for xmlsitemap.'),
+    'fields' => array(
+      'nid' => array(
+        'description' => t('The path of this node.'),
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'pid' => array(
+        'description' => t('The id of the path.'),
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => FALSE,
+        'default' => 0,
+      ),
+      'last_changed' => array(
+        'description' => t('Keeps track of new changes.'),
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'previously_changed' => array(
+        'description' => t('Keeps track of old changes.'),
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'last_comment' => array(
+        'description' => t('Link to last comment.'),
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'previous_comment' => array(
+        'description' => t('Link to previous comment.'),
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => FALSE,
+        'default' => 0,
+      ),
+      'priority_override' => array(
+        'description' => t('Stores the index value.'),
+        'type' => 'float',
+        'not null' => FALSE,
+      ),
+    ),
+    'indexes' => array(
+      'pid' => array('pid'),
+    ),
+    'primary key' => array('nid'),
+  );
+
+  return $schema;
+}
+
+/**
  * Implementation of hook_install().
  */
-function xmlsitemap_node_install() {           
-  switch ($GLOBALS['db_type']) {
-    case 'mysql':
-    case 'mysqli':
-      db_query("CREATE TABLE {xmlsitemap_node} (
-        nid int,
-        pid int,
-        last_changed int(11),
-        previously_changed int(11),
-        last_comment int(11),
-        previous_comment int(11),
-        priority_override float,
-        PRIMARY KEY (nid)
-      ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
-      break;
-    case 'pgsql':
-      db_query("CREATE TABLE {xmlsitemap_node} (
-        nid integer,
-        pid integer,
-        last_changed integer,
-        previously_changed integer,
-        last_comment integer,
-        previous_comment integer,
-        priority_override real,
-        PRIMARY KEY (nid)
-      );");
-      break;
+function xmlsitemap_node_install() {
+  // Create my tables.
+  drupal_install_schema('xmlsitemap_node');
+}
+
+/**
+ * Implementation of hook_uninstall().
+ */
+function xmlsitemap_node_uninstall() {
+  // Drop my tables.
+  $settings = db_query("SELECT name FROM {variable} WHERE name LIKE 'xmlsitemap\_node\_%'");
+  while ($variable = db_fetch_array($settings)) {
+    variable_del($variable->name);
   }
+  drupal_uninstall_schema('xmlsitemap_node');
 }
 
 /**
@@ -98,15 +149,3 @@
 function xmlsitemap_node_disable() {
   xmlsitemap_update_sitemap();
 }
-
-/**
- * Implementation of hook_uninstall().
- */
-function xmlsitemap_node_uninstall() {
-  db_query("DROP TABLE {xmlsitemap_node}");
-  $settings = db_query("SELECT name FROM {variable} WHERE name LIKE 'xmlsitemap\_node\_%'");
-  while ($variable = db_fetch_array($settings)) {
-    variable_del($variable->name);
-  }
-}
-
diff -ruN xmlsitemap/xmlsitemap_node/xmlsitemap_node.module xmlsitemap.new/xmlsitemap_node/xmlsitemap_node.module
--- xmlsitemap/xmlsitemap_node/xmlsitemap_node.module	2008-01-08 06:13:35.000000000 +0100
+++ xmlsitemap.new/xmlsitemap_node/xmlsitemap_node.module	2008-04-14 19:36:28.000000000 +0200
@@ -161,7 +161,7 @@
 /**
  * Implementation of hook_form_alter().
  */
-function xmlsitemap_node_form_alter($form_id, &$form) {
+function xmlsitemap_node_form_alter(&$form, &$form_state, $form_id) {
   switch ($form_id) {
     case $form['type']['#value'] .'_node_form':
       if (isset($form['type'])) {
@@ -206,7 +206,7 @@
           '#description' => t('This number will be added to the priority of this content type.'),
         );
         $form['xmlsitemap_old_priority'] = array('#type' => 'value', '#value' => variable_get("xmlsitemap_node_type_priority_{$form['#node_type']->type}", 0.1));
-        $form['#submit']['_xmlsitemap_node_submit'] = array();
+        $form['#submit'][] = '_xmlsitemap_node_submit';
         $form['submit']['#weight'] = 1;
         $form['reset']['#weight'] = 1;
       }
@@ -335,13 +335,13 @@
  * Add submit actions to forms.
  * @return None
  */
-function _xmlsitemap_node_submit($form_id, $form_values) {
+function _xmlsitemap_node_submit($form, &$form_state) {
   switch ($form_id) {
     case 'node_type_form':
-      $op = isset($form_values['op']) ? $form_values['op'] : '';
-      $type = isset($form_values['old_type']) ? $form_values['old_type'] : trim($form_values['type']);
-      $priority = $form_values['xmlsitemap_node_type_priority'];
-      $old_priority = $form_values['xmlsitemap_old_priority'];
+      $op = isset($form_state['values']['op']) ? $form_state['values']['op'] : '';
+      $type = isset($form_state['values']['old_type']) ? $form_state['values']['old_type'] : trim($form_state['values']['type']);
+      $priority = $form_state['values']['xmlsitemap_node_type_priority'];
+      $old_priority = $form_state['values']['xmlsitemap_old_priority'];
       if ($op == t('Save content type') && $priority != $old_priority || $op == t('Reset to defaults') && $old_priority != 0.1) {
         xmlsitemap_update_sitemap();
       }
diff -ruN xmlsitemap/xmlsitemap_term/xmlsitemap_term.info xmlsitemap.new/xmlsitemap_term/xmlsitemap_term.info
--- xmlsitemap/xmlsitemap_term/xmlsitemap_term.info	2008-01-21 01:15:00.000000000 +0100
+++ xmlsitemap.new/xmlsitemap_term/xmlsitemap_term.info	2008-04-14 19:36:28.000000000 +0200
@@ -1,13 +1,15 @@
-; $Id: xmlsitemap_term.info,v 1.1 2007/11/09 17:56:05 darrenoh Exp $
-name = XML Sitemap: Term
-description = Adds taxonomy terms to the site map.
-package = XML Sitemap
-dependencies = xmlsitemap
-
-
-; Information added by drupal.org packaging script on 2008-01-21
-version = "6.x-0.x-dev"
-core = "6.x"
-project = "xmlsitemap"
-datestamp = "1200874500"
-
+; $Id: xmlsitemap_term.info,v 1.1 2007/11/09 17:56:05 darrenoh Exp $
+name = XML Sitemap: Term
+description = Adds taxonomy terms to the site map.
+package = XML Sitemap
+dependencies[] = xmlsitemap
+core = 6.x
+version = 6.x-1.x-dev
+
+
+; Information added by drupal.org packaging script on 2008-01-21
+version = "6.x-0.x-dev"
+core = "6.x"
+project = "xmlsitemap"
+datestamp = "1200874500"
+
diff -ruN xmlsitemap/xmlsitemap_term/xmlsitemap_term.install xmlsitemap.new/xmlsitemap_term/xmlsitemap_term.install
--- xmlsitemap/xmlsitemap_term/xmlsitemap_term.install	2007-12-06 18:41:15.000000000 +0100
+++ xmlsitemap.new/xmlsitemap_term/xmlsitemap_term.install	2008-04-14 19:36:28.000000000 +0200
@@ -2,32 +2,53 @@
 // $Id: xmlsitemap_term.install,v 1.3 2007/12/06 17:41:15 darrenoh Exp $
 
 /**
- * Implementation of hook_install().
+ * Implementation of hook_schema().
  */
-function xmlsitemap_term_install() {           
-  switch ($GLOBALS['db_type']) {
-    case 'mysql':
-    case 'mysqli':
-      db_query("CREATE TABLE {xmlsitemap_term} (
-        tid int,
-        pid int,
-        last_changed int(11),
-        previously_changed int(11),
-        priority_override float,
-        PRIMARY KEY (tid)
-      ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
-      break;
-    case 'pgsql':
-      db_query("CREATE TABLE {xmlsitemap_term} (
-        tid integer,
-        pid integer,
-        last_changed integer,
-        previously_changed integer,
-        priority_override real,
-        PRIMARY KEY (tid)
-      );");
-      break;
-  }
+function xmlsitemap_term_schema() {
+  $schema['xmlsitemap_term'] = array(
+    'description' => t('The base table for xmlsitemap.'),
+    'fields' => array(
+      'tid' => array(
+        'description' => t('The id of the path.'),
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'pid' => array(
+        'description' => t('The id of the path.'),
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'last_changed' => array(
+        'description' => t('Keeps track of new changes.'),
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'previously_changed' => array(
+        'description' => t('Keeps track of old changes.'),
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'priority_override' => array(
+        'description' => t('Stores the index value.'),
+        'type' => 'float',
+        'not null' => FALSE,
+      ),
+    ),
+    'indexes' => array(
+      'pid' => array('pid'),
+    ),
+    'primary key' => array('tid'),
+  );
+
+  return $schema;
 }
 
 /**
@@ -67,14 +88,22 @@
   xmlsitemap_update_sitemap();
 }
 
+
+/**
+ * Implementation of hook_uninstall().
+ */
+function xmlsitemap_term_install() {
+  drupal_install_schema('xmlsitemap_term');
+}
+
 /**
  * Implementation of hook_uninstall().
  */
 function xmlsitemap_term_uninstall() {
-  db_query("DROP TABLE {xmlsitemap_term}");
   $settings = db_query("SELECT name FROM {variable} WHERE name LIKE 'xmlsitemap\_term\_%'");
   while ($variable = db_fetch_object($settings)) {
     variable_del($variable->name);
   }
+  drupal_uninstall_schema('xmlsitemap_term');
 }
 
diff -ruN xmlsitemap/xmlsitemap_term/xmlsitemap_term.module xmlsitemap.new/xmlsitemap_term/xmlsitemap_term.module
--- xmlsitemap/xmlsitemap_term/xmlsitemap_term.module	2007-12-13 03:18:30.000000000 +0100
+++ xmlsitemap.new/xmlsitemap_term/xmlsitemap_term.module	2008-04-14 19:36:28.000000000 +0200
@@ -129,7 +129,7 @@
 /**
  * Implementation of hook_form_alter().
  */
-function xmlsitemap_term_form_alter($form_id, &$form) {
+function xmlsitemap_term_form_alter(&$form, &$form_state, $form_id) {
   switch ($form_id) {
     case 'taxonomy_form_term':
       $priority = db_result(db_query("SELECT priority_override FROM {xmlsitemap_term} WHERE tid = %d", $form['tid']['#value']));
diff -ruN xmlsitemap/xmlsitemap_user/xmlsitemap_user.info xmlsitemap.new/xmlsitemap_user/xmlsitemap_user.info
--- xmlsitemap/xmlsitemap_user/xmlsitemap_user.info	2008-01-21 01:15:00.000000000 +0100
+++ xmlsitemap.new/xmlsitemap_user/xmlsitemap_user.info	2008-04-14 19:36:28.000000000 +0200
@@ -1,13 +1,15 @@
-; $Id: xmlsitemap_user.info,v 1.1 2007/11/09 17:56:05 darrenoh Exp $
-name = XML Sitemap: User
-description = Adds user profiles to the site map.
-package = XML Sitemap
-dependencies = xmlsitemap
-
-
-; Information added by drupal.org packaging script on 2008-01-21
-version = "6.x-0.x-dev"
-core = "6.x"
-project = "xmlsitemap"
-datestamp = "1200874500"
-
+; $Id: xmlsitemap_user.info,v 1.1 2007/11/09 17:56:05 darrenoh Exp $
+name = XML Sitemap: User
+description = Adds user profiles to the site map.
+package = XML Sitemap
+dependencies[] = xmlsitemap
+core = 6.x
+version = 6.x-1.x-dev
+
+
+; Information added by drupal.org packaging script on 2008-01-21
+version = "6.x-0.x-dev"
+core = "6.x"
+project = "xmlsitemap"
+datestamp = "1200874500"
+
diff -ruN xmlsitemap/xmlsitemap_user/xmlsitemap_user.install xmlsitemap.new/xmlsitemap_user/xmlsitemap_user.install
--- xmlsitemap/xmlsitemap_user/xmlsitemap_user.install	2007-12-06 18:41:15.000000000 +0100
+++ xmlsitemap.new/xmlsitemap_user/xmlsitemap_user.install	2008-04-14 19:36:28.000000000 +0200
@@ -2,42 +2,76 @@
 // $Id: xmlsitemap_user.install,v 1.4 2007/12/06 17:41:15 darrenoh Exp $
 
 /**
- * Implementation of hook_install().
+ * Implementation of hook_schema().
  */
-function xmlsitemap_user_install() {           
-  switch ($GLOBALS['db_type']) {
-    case 'mysql':
-    case 'mysqli':
-      db_query("CREATE TABLE {xmlsitemap_user} (
-        uid int,
-        pid int,
-        last_changed int(11),
-        previously_changed int(11),
-        priority_override float,
-        PRIMARY KEY (uid)
-      ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
-      db_query("CREATE TABLE {xmlsitemap_user_role} (
-        rid int,
-        priority float NOT NULL DEFAULT 0,
-        PRIMARY KEY (rid)
-      ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
-      break;
-    case 'pgsql':
-      db_query("CREATE TABLE {xmlsitemap_user} (
-        uid integer,
-        pid integer,
-        last_changed integer,
-        previously_changed integer,
-        priority_override real,
-        PRIMARY KEY (uid)
-      );");
-      db_query("CREATE TABLE {xmlsitemap_user_role} (
-        rid integer,
-        priority real NOT NULL DEFAULT 0,
-        PRIMARY KEY (rid)
-      ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
-      break;
-  }
+function xmlsitemap_user_schema() {
+  $schema['xmlsitemap_user'] = array(
+    'description' => t('The base table for xmlsitemap.'),
+    'fields' => array(
+      'uid' => array(
+        'description' => t('The id of the path.'),
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'pid' => array(
+        'description' => t('The id of the path.'),
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'last_changed' => array(
+        'description' => t('Keeps track of new changes.'),
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'previously_changed' => array(
+        'description' => t('Keeps track of old changes.'),
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'priority_override' => array(
+        'description' => t('Stores the index value.'),
+        'type' => 'float',
+        'not null' => FALSE,
+      ),
+    ),
+    'indexes' => array(
+      'pid' => array('pid'),
+    ),
+    'primary key' => array('uid'),
+  );
+
+  $schema['xmlsitemap_user_role'] = array(
+    'description' => t('The base table for xmlsitemap.'),
+    'fields' => array(
+      'rid' => array(
+        'description' => t('The id of the path.'),
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+      'priority' => array(
+        'description' => t('Stores the index value.'),
+        'type' => 'float',
+        'not null' => TRUE,
+        'default' => 0,
+      ),
+    ),
+    'indexes' => array(
+      'pid' => array('rid'),
+    ),
+    'primary key' => array('rid'),
+  );
+
+  return $schema;
 }
 
 /**
@@ -84,10 +118,16 @@
 }
 
 /**
+ * Implementation of hook_install().
+ */
+function xmlsitemap_user_install() {
+  drupal_install_schema('xmlsitemap_user');
+}
+
+/**
  * Implementation of hook_uninstall().
  */
 function xmlsitemap_user_uninstall() {
-  db_query("DROP TABLE {xmlsitemap_user}");
-  db_query("DROP TABLE {xmlsitemap_user_role}");
+  drupal_uninstall_schema('xmlsitemap_user');
 }
 
diff -ruN xmlsitemap/xmlsitemap_user/xmlsitemap_user.module xmlsitemap.new/xmlsitemap_user/xmlsitemap_user.module
--- xmlsitemap/xmlsitemap_user/xmlsitemap_user.module	2007-12-10 04:15:19.000000000 +0100
+++ xmlsitemap.new/xmlsitemap_user/xmlsitemap_user.module	2008-04-14 19:36:28.000000000 +0200
@@ -90,7 +90,7 @@
 /**
  * Implementation of hook_form_alter().
  */
-function xmlsitemap_user_form_alter($form_id, &$form) {
+function xmlsitemap_user_form_alter(&$form, &$form_state, $form_id) {
   switch ($form_id) {
     case 'user_admin_settings':
       $form['xmlsitemap'] = array(
@@ -107,7 +107,7 @@
         '#description' => t('Choose the default priority for users who have only the authenticated user role.'),
       );
       $form['buttons']['#weight'] = 1;
-      $form['#submit']['_xmlsitemap_user_submit'] = array();
+      $form['#submit'][] = '_xmlsitemap_user_submit';
       break;
     case 'user_admin_role':
       $form['xmlsitemap_user_role_priority'] = array(
@@ -119,7 +119,7 @@
       );
       $form['submit']['#weight'] = 1;
       $form['delete']['#weight'] = 1;
-      $form['#submit']['_xmlsitemap_user_submit'] = array();
+      $form['#submit'][] = '_xmlsitemap_user_submit';
       break;
   }
 }
@@ -128,23 +128,23 @@
  * Add submit actions to forms.
  * @return None
  */
-function _xmlsitemap_user_submit($form_id, $form_values) {
+function _xmlsitemap_user_submit(&$form, &$form_state, $form_id) {
   switch ($form_id) {
     case 'user_admin_settings':
-      if ($form_values['xmlsitemap_user_default_priority'] != $form_values['xmlsitemap_user_old_default_priority']) {
+      if ($form_state['values']['xmlsitemap_user_default_priority'] != $form_state['values']['xmlsitemap_user_old_default_priority']) {
         xmlsitemap_update_sitemap();
       }
       break;
     case 'user_admin_role':
-      $priority = db_result(db_query("SELECT priority FROM {xmlsitemap_user_role} WHERE rid = %d", $form_values['rid']));
-      if ($form_values['op'] == t('Delete role')) {
-        db_query("DELETE FROM {xmlsitemap_user_role} WHERE rid = %d", $form_values['rid']);
+      $priority = db_result(db_query("SELECT priority FROM {xmlsitemap_user_role} WHERE rid = %d", $form_state['values']['rid']));
+      if ($form_state['values']['op'] == t('Delete role')) {
+        db_query("DELETE FROM {xmlsitemap_user_role} WHERE rid = %d", $form_state['values']['rid']);
         if ($priority > 0 || $priority < 0) {
           xmlsitemap_update_sitemap();
         }
       }
-      elseif ($form_values['xmlsitemap_user_role_priority'] != $priority) {
-        db_query("UPDATE {xmlsitemap_user_role} SET priority = %f WHERE rid = %d", $form_values['xmlsitemap_user_role_priority'], $form_values['rid']);
+      elseif ($form_state['values']['xmlsitemap_user_role_priority'] != $priority) {
+        db_query("UPDATE {xmlsitemap_user_role} SET priority = %f WHERE rid = %d", $form_state['values']['xmlsitemap_user_role_priority'], $form_state['values']['rid']);
         xmlsitemap_update_sitemap();
       }
       break;
