diff --git a/token_array.module b/token_array.module
index 50ce8d5..b31b013 100644
--- a/token_array.module
+++ b/token_array.module
@@ -1,11 +1,12 @@
 <?php
+// $Id: token_array.module,v 1.1.2.4 2010/12/30 09:25:18 itangalo Exp $
 
 /**
  * @file
  * Provides token for multiple-value fields and taxonomy terms.
  *
  * This file contains token lists and token values for two types of multiple
- * node values – CCK fields and taxonomy terms. It also contains a few small
+ * node values ‚Äì CCK fields and taxonomy terms. It also contains a few small
  * helper functions.
  *
  * Note that this is an experimental module, built by an inexpererienced coder.
@@ -78,9 +79,9 @@ function token_array_get_field_keys($field) {
   $keys = array('view');
 
   $additional_keys = array(
-    'filefield' => 'fid',
-    'nodereference' => 'nid',
-    'userreference' => 'uid',
+    'filefield' => array('fid'),
+    'nodereference' => array('nid'),
+    'userreference' => array('uid', 'mail'),
   );
   if (isset($additional_keys[$field['type']])) {
     $keys[] = $additional_keys[$field['type']];
@@ -132,21 +133,36 @@ function token_array_token_values($type, $object = NULL) {
           // Loop through each field in this node type
           foreach ($type['fields'] as $field) {
             // Loop through each field key that should be used to build array tokens
-            foreach (token_array_get_field_keys($field) as $field_key) {
-
-              // Add each field value to a temporary array,
-              // formatted according to the merge style
-              $list = array();
-              if (isset($node->{$field['field_name']})) {
-                foreach ($node->{$field['field_name']} as $item) {
-                  $list[] = $merge_style['prefix'] . $item[$field_key] . $merge_style['suffix'];
-                }
+            foreach (token_array_get_field_keys($field) as $field_keys) {
+              if (!is_array($field_keys)) {
+                $field_keys = array($field_keys);
               }
+              foreach ($field_keys as $field_key) {
+                // If $field_key equals "mail", load mail.
+                if ($field_key == 'mail') {
+
+                }
+
+                // Add each field value to a temporary array,
+                // formatted according to the merge style
+                $list = array();
+                if (isset($node->{$field['field_name']})) {
+                  foreach ($node->{$field['field_name']} as $item) {
+                    if ($field_key == 'mail') {
+                      $account = user_load($item['uid']);
+                      $list[] = $merge_style['prefix'] . $account->mail . $merge_style['suffix'];
+                    }
+                    else {
+                      $list[] = $merge_style['prefix'] . $item[$field_key] . $merge_style['suffix'];
+                    }
+                  }
+                }
 
-              // Implode the values for this field and add it to the tokens,
-              // formatted according to the merge style
-              $tokens[$field['field_name'] . '-' . $machine_name . '-array-' . $field_key]
-                = implode($merge_style['infix'], $list);
+                // Implode the values for this field and add it to the tokens,
+                // formatted according to the merge style
+                $tokens[$field['field_name'] . '-' . $machine_name . '-array-' . $field_key]
+                  = implode($merge_style['infix'], $list);
+              }
             }
           }
         }
@@ -194,12 +210,17 @@ function token_array_token_list($type = 'all') {
         foreach (content_fields() as $field) {
 
           // Loop through each field key that could be used to build array tokens
-          foreach (token_array_get_field_keys($field) as $field_key) {
+          foreach (token_array_get_field_keys($field) as $field_keys) {
+            if (!is_array($field_keys)) {
+              $field_keys = array($field_keys);
+            }
+            foreach ($field_keys as $field_key) {
+              // The complex thing here is the key ‚Äì¬†the defining name of the token
+              $list['CCK array'][$field['field_name'] . '-' . $machine_name . '-array-' . $field_key] =
+                t('@field_key values of field %field merged with style %name',
+                  array('@field_key' => $field_key, '%field' => $field['field_name'], '%name' => t($merge_style['name'])));
 
-            // The complex thing here is the key – the defining name of the token
-            $list['CCK array'][$field['field_name'] . '-' . $machine_name . '-array-' . $field_key] =
-              t('@field_key values of field %field merged with style %name',
-                array('@field_key' => $field_key, '%field' => $field['field_name'], '%name' => t($merge_style['name'])));
+            }
           }
         }
       }
