diff -upr stock/token/token_cck.inc modified/token/token_cck.inc
--- stock/token/token_cck.inc	2008-02-23 06:12:39.000000000 -0600
+++ modified/token/token_cck.inc	2008-04-01 06:37:07.000000000 -0500
@@ -15,10 +15,10 @@ function content_token_values($type, $ob
       
       $items = $node->$field['field_name'];
       if (!empty($items)) {
-        $function = $field_types[$field['type']]['module'] . '_token_values';
+        $function = $field_types[$field['type']]['module'] .'_token_values';
         if (function_exists($function)) {
           $sub_list = $function('field', $items);
-          foreach($sub_list as $token => $value) {
+          foreach ($sub_list as $token => $value) {
             $tokens[$field['field_name'] .'-'. $token] = $value;
           }
         }
@@ -35,7 +35,7 @@ function content_token_list($type = 'all
 
     foreach (content_fields() as $field) {
       $sub_list = array();
-      $function = $field_types[$field['type']]['module'] . '_token_list';
+      $function = $field_types[$field['type']]['module'] .'_token_list';
       if (function_exists($function)) {
         $sub_list = $function('field');
         foreach ($sub_list as $category => $token_list) {
diff -upr stock/token/token.module modified/token/token.module
--- stock/token/token.module	2008-01-17 04:46:16.000000000 -0600
+++ modified/token/token.module	2008-04-01 06:40:35.000000000 -0500
@@ -20,7 +20,7 @@ function theme_token_help($type = 'all',
   $headers = array(t('Token'), t('Replacement value'));
   $rows = array();
   foreach ($full_list as $key => $category) {
-    $rows[] = array(array('data' => drupal_ucfirst($key) . ' ' . t('tokens'), 'class' => 'region', 'colspan' => 2));
+    $rows[] = array(array('data' => drupal_ucfirst($key) .' '. t('tokens'), 'class' => 'region', 'colspan' => 2));
     foreach ($category as $token => $description) {
       $row = array();
       $row[] = $prefix . $token . $suffix;
@@ -34,7 +34,7 @@ function theme_token_help($type = 'all',
 }
 
 /**
- * Sample implementation of hook_token_values(). 
+ * Sample implementation of hook_token_values().
  *
  * @param type
  *   A flag indicating the class of substitution tokens to use. If an
@@ -159,7 +159,7 @@ function token_replace($original, $type 
  *   An array of substitution classes and optional objects. The key is
  *   a flag indicating the class of substitution tokens to use.
  *   If an object is passed as value, the key should contain the
- *   object's type. For example, 'node', 'comment', or 'user'. The 
+ *   object's type. For example, 'node', 'comment', or 'user'. The
  *   object will be used for building substitution values. If no type
  *   is specified, only 'global' site-wide substitution tokens are built.
  * @param leading
diff -upr stock/token/token_node.inc modified/token/token_node.inc
--- stock/token/token_node.inc	2007-10-28 11:10:41.000000000 -0500
+++ modified/token/token_node.inc	2008-04-01 06:41:40.000000000 -0500
@@ -54,7 +54,7 @@ function node_token_values($type, $objec
       global $_menu;
       $trail = array();
       $trail_raw = array();
-      $original_mid = token_menu_get_mid('node/'.$node->nid);
+      $original_mid = token_menu_get_mid('node/'. $node->nid);
       
       $mid = $original_mid;
       while ($mid && $_menu['visible'][$mid] && $_menu['visible'][$mid]['pid'] != 0) {
@@ -90,17 +90,17 @@ function node_token_values($type, $objec
           if ((object)$term) {
             // With freetagging it's somewhat hard to get the tid, vid, name values
             // Rather than duplicating taxonomy.module code here you should make sure your calling module
-            // has a weight of at least 1 which will run after taxonomy has saved the data which allows us to 
+            // has a weight of at least 1 which will run after taxonomy has saved the data which allows us to
             // pull it out of the db here.
             if (!isset($term->name) || !isset($term->tid)) {
-              $vid = db_result(db_query("SELECT t.vid 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.nid = %d ORDER BY v.weight, t.weight, t.name LIMIT 1", $object->nid));
-              $term = db_fetch_object(db_query("SELECT t.tid, t.name FROM {term_data} t INNER JOIN {term_node} r ON r.tid = t.tid WHERE t.vid = %d AND r.nid = %d ORDER BY weight LIMIT 1", $vid, $object->nid));
+              $vid = db_result(db_query_range("SELECT t.vid 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.nid = %d ORDER BY v.weight, t.weight, t.name", 0, 1, $object->nid));
+              $term = db_fetch_object(db_query_range("SELECT t.tid, t.name FROM {term_data} t INNER JOIN {term_node} r ON r.tid = t.tid WHERE t.vid = %d AND r.nid = %d ORDER BY weight", 0, 1, $vid, $object->nid));
               $term->vid = $vid;
             }
 
             // Ok, if we still don't have a term name maybe this is a pre-taxonomy submit node
             // So if it's a number we can get data from it
-            if(!isset($term->name) && is_array($original_term)) {
+            if (!isset($term->name) && is_array($original_term)) {
               $tid = array_shift($original_term);
               if (is_numeric($tid)) {
                 $term = taxonomy_get_term($tid);
@@ -111,7 +111,7 @@ function node_token_values($type, $objec
             $values['term-id'] = $term->tid;
             $vid = $term->vid;
 
-            if(!empty($vid)) {
+            if (!empty($vid)) {
               $vocabulary = taxonomy_get_vocabulary($vid);
               $values['vocab'] = check_plain($vocabulary->name);
               $values['vocab-raw'] = $vocabulary->name;
@@ -128,8 +128,8 @@ function node_token_values($type, $objec
             break;
           }
         }
-      } 
-      // It's possible to leave that block and still not have good data.  
+      }
+      // It's possible to leave that block and still not have good data.
       // So, we test for these and if not set, set them.
       if (!isset($values['term'])) {
         $values['term'] = '';
@@ -212,15 +212,15 @@ function book_token_values($type, $objec
         if ($bookpath == '') {
           $bookpath = check_plain($bookelement->title);
           $bookpath_raw = $bookelement->title;
-        } 
+        }
         else {
-          $bookpath = $bookpath . '/' . check_plain($bookelement->title);
-          $bookpath_raw = $bookpath_raw . '/' . $bookelement->title;
+          $bookpath = $bookpath .'/'. check_plain($bookelement->title);
+          $bookpath_raw = $bookpath_raw .'/'. $bookelement->title;
         }
       }
       $tokens['bookpath'] = $bookpath;
       $tokens['bookpath-raw'] = $bookpath_raw;
-    } 
+    }
     else {
       $tokens['book'] = '';
       $tokens['book_id'] = '';
