diff --git a/workflow.module b/workflow.module
index 8a11f9d..4066654 100644
--- a/workflow.module
+++ b/workflow.module
@@ -183,26 +183,33 @@ function workflow_user_delete($account) {
 function workflow_tokens($type, $tokens, array $data = array(), array $options = array()) {
   $values = array();
   switch ($type) {
-    case 'node':
     case 'workflow':
       $node = $data['node'];
       if ($workflow = workflow_get_workflow_type_map_by_type($node->type)) {
         // TODO If we ever move Workflow to allow M:M content types to workflows, this will need updating.
         if ($workflow = workflow_get_workflows_by_wid($workflow->wid)) {
           $wid = $workflow->wid;
-          $values['workflow-name'] = $workflow->name;
+          $values['[workflow:workflow-name]'] = $workflow->name;
           $last_history = workflow_get_workflow_node_history_by_nid($node->nid, 1);
           if (isset($node->workflow) && !isset($node->workflow_stamp)) {
             // The node is being submitted but the form data has not been saved to the database yet,
             // so we set the token values from the workflow form fields.
-            $sid = $node->workflow;
-            $old_sid = isset($last_history->sid) ? $last_history->sid : workflow_get_creation_state_by_wid($workflow->wid);
+            $sid = isset($last_history->sid) ? $last_history->sid : $node->workflow;
+            $old_sid = isset($last_history->old_sid) ? $last_history->old_sid : workflow_get_creation_state_by_wid($workflow->wid);
             $sid = workflow_get_workflow_states_by_sid($sid);
             $old_sid = workflow_get_workflow_states_by_sid($old_sid);
             $date = REQUEST_TIME;
-            $user_name = $node->uid ? $node->name : variable_get('anonymous', 'Anonymous');
-            $uid = $node->uid;
-            $mail = ($node->uid && isset($node->user_mail)) ? $node->user_mail : '';
+            $uid = isset($last_history->uid) ? $last_history->uid : $node->uid;
+            if (isset($uid))
+            {
+              $account = user_load($uid);
+              $mail = $account->mail;
+            }
+            else
+            {
+              $mail = '';
+            }
+            $user_name = isset($uid) ? $account->name : variable_get('anonymous', 'Anonymous');
             $comment = isset($node->workflow_comment) ? $node->workflow_comment : '';
           }
           elseif (!isset($node->workflow) && empty($last_history->sid)) {
@@ -218,7 +225,15 @@ function workflow_tokens($type, $tokens, array $data = array(), array $options =
             $date = REQUEST_TIME;
             $user_name = $node->uid ? $node->name : variable_get('anonymous', 'Anonymous');
             $uid = $node->uid;
-            $mail = ($node->uid && isset($node->user_mail)) ? $node->user_mail : '';
+            if (isset($uid))
+            {
+              $account = user_load($uid);
+              $mail = $account->mail;
+            }
+            else
+            {
+              $mail = '';
+            }
             $comment = isset($node->workflow_comment) ? $node->workflow_comment : '';
           }
           else {
@@ -234,15 +249,15 @@ function workflow_tokens($type, $tokens, array $data = array(), array $options =
             $mail = $account->uid ? $account->mail : '';
             $comment = $last_history->comment;
           }
-          $values['workflow-current-state-name']                =  $sid->state;
-          $values['workflow-old-state-name']                    =  $old_sid->state;
-          $values['workflow-current-state-date-iso']            =  date('Ymdhis', $date);
-          $values['workflow-current-state-date-tstamp']         =  $date;
-          $values['workflow-current-state-date-formatted']      =  date('M d, Y h:i:s', $date);
-          $values['workflow-current-state-updating-user-name']  = check_plain($user_name);
-          $values['workflow-current-state-updating-user-uid']   = $uid;
-          $values['workflow-current-state-updating-user-mail']  = check_plain($mail);
-          $values['workflow-current-state-log-entry']           = filter_xss($comment, array('a', 'em', 'strong'));
+          $values['[workflow:workflow-current-state-name]']                = $sid->state;
+          $values['[workflow:workflow-old-state-name]']                    = $old_sid->state;
+          $values['[workflow:workflow-current-state-date-iso]']            = date('Ymdhis', $date);
+          $values['[workflow:workflow-current-state-date-tstamp]']         = $date;
+          $values['[workflow:workflow-current-state-date-formatted]']      = date('M d, Y h:i:s', $date);
+          $values['[workflow:workflow-current-state-updating-user-name]']  = check_plain($user_name);
+          $values['[workflow:workflow-current-state-updating-user-uid]']   = $uid;
+          $values['[workflow:workflow-current-state-updating-user-mail]']  = check_plain($mail);
+          $values['[workflow:workflow-current-state-log-entry]']           = filter_xss($comment, array('a', 'em', 'strong'));
         }
       }
     break;
@@ -433,7 +448,7 @@ function workflow_features_api() {
 /**
  * Business related functions, the API.
  */
- 
+
 /**
  * Validate target state and either execute a transition immediately or schedule
  * a transition to be executed later by cron.
@@ -794,7 +809,7 @@ function workflow_node_current_state($node) {
   // There is no nid when creating a node.
   if (!empty($node->nid)) {
     $state = workflow_get_workflow_node_by_nid($node->nid);
-    if($state){  
+    if($state){
       $sid = $state->sid;
     }
   }
@@ -874,7 +889,7 @@ function workflow_get_creation_state_by_wid($wid) {
 
 /**
  * Get all workflows.
- */ 
+ */
 function workflow_get_workflows() {
   $results = db_query('SELECT * FROM {workflows}');
   $workflows = $results->fetchAll();
@@ -967,7 +982,7 @@ function workflow_update_workflows(&$data, $create_creation_state = TRUE) {
 /**
  * Functions related to table workflow_type_map.
  */
- 
+
 /**
  * Get all workflow_type_map.
  */
@@ -1033,7 +1048,7 @@ function workflow_insert_workflow_type_map(&$data) {
 /**
  * Functions related to table workflow_transitions.
  */
- 
+
 /**
  * Given a tid, get the transition. It is a unique object, only one return.
  */
@@ -1133,7 +1148,7 @@ function workflow_update_workflow_transitions_roles($tid, $roles) {
 /**
  * Functions related to table workflow_states.
  */
- 
+
 /**
  * Get all states in the system, with options to filter, only where a workflow exists.
  */
