diff --git a/expire.module b/expire.module
index 67d82a4..1368545 100644
--- a/expire.module
+++ b/expire.module
@@ -323,8 +323,9 @@ function expire_node(&$node) {
     $filenames = array();
     foreach ($tids as $tid) {
       if (is_numeric($tid)) {
-        $term = taxonomy_get_term($tid);
-        $paths['term' . $tid] = taxonomy_term_path($term);
+        $term = taxonomy_term_load($tid);
+        $term_path = taxonomy_term_uri($term);
+        $paths['term' . $tid] = $term_path['path'];
       }
     }
   }
@@ -490,13 +491,19 @@ function expire_get_menu_structure($menu, $found, $needle, $first, &$found_globa
  *  http://drupal.org/node/545922
  */
 function expire_taxonomy_node_get_tids($nid) {
-  $vid = db_result(db_query("SELECT vid FROM {node} WHERE nid = %d", $nid));
-  $result = db_query(db_rewrite_sql("SELECT t.tid FROM {term_node} r INNER JOIN {term_data} t ON r.tid = t.tid INNER JOIN {vocabulary} v ON t.vid = v.vid WHERE r.vid = %d ORDER BY v.weight, t.weight, t.name", 't', 'tid'), $vid);
-  $tids = array();
-  while ($term = db_result($result)) {
-    $tids[] = $term;
-  }
-  return $tids;
+  // based on http://drupal.org/node/959984
+  $query = db_select('taxonomy_index', 'r');
+  $t_alias = $query->join('taxonomy_term_data', 't', 'r.tid = t.tid');
+  $v_alias = $query->join('taxonomy_vocabulary', 'v', 't.vid = v.vid');
+  $query->fields( $t_alias );
+  $query->condition("r.nid", $nid);
+  $result = $query->execute();
+
+  $terms = array();
+  foreach ($result as $term) {
+    $terms[] = $term;
+  }
+  return $terms;
 }
 
 /**
@@ -608,8 +615,8 @@ function expire_path_redirect_load($where = array(), $args = array(), $sort = ar
       $sql .= ' ORDER BY '. implode(' ,', $sort);
     }
     $result = db_query($sql, $args);
-    while ($redirect = db_fetch_array($result)) {
-      $redirects[] = $redirect;
+    foreach ($result as $redirect) {
+      $redirects[] = (array)$redirect;
     }
     return $redirects;
   }
@@ -689,14 +696,14 @@ function expire_get_domains(&$node) {
   $domains = array();
   if ($node->nid) {
     $result = db_query("SELECT gid FROM {domain_access} WHERE nid = %d", $node->nid);
-    while ($row = db_fetch_array($result)) {
+    foreach ($result as $row) {
       $gid = $row['gid'];
       $domains[$gid] = $gid;
     }
   }
   elseif ($node->mail && $node->name) {
     $result = db_query("SELECT domain_id FROM {domain_editor} WHERE uid = %d", $node->uid);
-    while ($row = db_fetch_array($result)) {
+    foreach ($result as $row) {
       $gid = $row['domain_id'];
       $domains[$gid] = $gid;
     }
@@ -709,6 +716,24 @@ function expire_normal_path_check($path) {
   $parts = array_slice($original_map, 0, MENU_MAX_PARTS);
   list($ancestors, $placeholders) = menu_get_ancestors($parts);
 
-  $router_item = db_query_range('SELECT path FROM {menu_router} WHERE path IN (:ancestors) ORDER BY fit DESC', 0, 1, array(':ancestors' => $ancestors))->fetchAssoc();
-  return $router_item;
+  $result = db_query_range('SELECT path FROM {menu_router} WHERE path IN (' . implode(',', $placeholders) . ') ORDER BY fit DESC', $ancestors, 0, 1);
+  $router_item = array_shift($result);
+  return (array)$router_item;
 }
+
+function taxonomy_node_get_terms($node, $key = 'tid') {
+  static $terms;
+  if (!isset($terms[$node->vid][$key])) {
+    $query = db_select('taxonomy_index', 'r');
+    $t_alias = $query->join('taxonomy_term_data', 't', 'r.tid = t.tid');
+    $v_alias = $query->join('taxonomy_vocabulary', 'v', 't.vid = v.vid');
+    $query->fields( $t_alias );
+    $query->condition("r.nid", $node->nid);
+    $result = $query->execute();
+    $terms[$node->vid][$key] = array();
+    foreach ($result as $term) {
+      $terms[$node->vid][$key][$term->$key] = $term;
+      }
+  }
+  return $terms[$node->vid][$key];
+}
\ No newline at end of file
