diff --git a/README.txt b/README.txt
index 7adb34a..34933b3 100644
--- a/README.txt
+++ b/README.txt
@@ -9,6 +9,7 @@ can optionally be mailed to e-mail addresses upon submission.
 Requirements
 ------------
 Drupal 7.x
+Token
 
 Installation
 ------------
@@ -34,8 +35,23 @@ have been running Webform 3.x on your Drupal 6 site before upgrading to Drupal
 
 3. Run update.php (at http://www.example.com/update.php)
 
+HOWTO: Using tokens in webforms as default value
+------------------------------------------------
+
+Let's say you have a webform that submits user related fields. The new token support
+for this module will now let you set default values for each field based on tokens. 
+You could for instance provide default values out of the user profile (Profile2 module)
+by just using the profile related tokens within the default value field of the edit 
+component form: 
+
+  1. Just edit or add a new component of a webform to display the mentioned "component edit form".
+  
+  2. Inside the form, navigate to the default value field.
+  
+  3. Right below this field you can see the collapsed fieldset "TOKEN VALUES". Open it
+     and set the default value for the field by just clicking on the desired token.
+
 Support
 -------
 Please use the issue queue for filing bugs with this module at
 http://drupal.org/project/issues/webform
-
diff --git a/includes/webform.emails.inc b/includes/webform.emails.inc
index 8343196..5ecba9b 100644
--- a/includes/webform.emails.inc
+++ b/includes/webform.emails.inc
@@ -297,7 +297,8 @@ function webform_email_edit_form($form, $form_state, $node, $email = array()) {
   );
 
   $form['template']['tokens'] = array(
-    '#value' => theme('webform_token_help'),
+    '#theme' => 'token_tree',
+    '#token_types' => array('webform-submission'),
   );
 
   $form['template']['components'] = array(
diff --git a/webform.info b/webform.info
index 149b887..704fee8 100644
--- a/webform.info
+++ b/webform.info
@@ -21,3 +21,7 @@ files[] = tests/components.test
 files[] = tests/permissions.test
 files[] = tests/submission.test
 files[] = tests/webform.test
+
+files[] = webform.tokens.inc
+
+dependencies[] = token
\ No newline at end of file
diff --git a/webform.module b/webform.module
index 612adb0..bc5be71 100644
--- a/webform.module
+++ b/webform.module
@@ -2593,6 +2593,19 @@ function _webform_filter_values($string, $node = NULL, $submission = NULL, $emai
     return $string;
   }
 
+    
+  //First, let the token api have at it
+  $token_data = array(
+    'user' => $user,
+  );
+  if ($node) {
+    $token_data['node'] = $node;
+  }
+  if ($submission) {
+    $token_data['webform-submission'] = $submission;
+  }
+  $string = token_replace($string, $token_data);
+  
   // Setup default token replacements.
   if (!isset($replacements)) {
     $replacements['unsafe'] = array();
@@ -2727,6 +2740,7 @@ function _webform_filter_values($string, $node = NULL, $submission = NULL, $emai
 
   $find = array_keys($safe_replacements);
   $replace = array_values($safe_replacements);
+
   $string = str_replace($find, $replace, $string);
 
   // Clean up any unused tokens.
@@ -2735,7 +2749,7 @@ function _webform_filter_values($string, $node = NULL, $submission = NULL, $emai
       $string = preg_replace('/\\' . $token . '\[\w+\]/', '', $string);
     }
   }
-
+  
   return $strict ? filter_xss($string) : $string;
 }
 
@@ -2894,14 +2908,17 @@ function theme_webform_token_help($variables) {
   }
 
   $fieldset = array(
-    '#title' => t('Token values'),
     '#type' => 'fieldset',
+    '#title' => t('Token values'),
     '#collapsible' => TRUE,
     '#collapsed' => TRUE,
-    '#children' => '<div>' . $output . '</div>',
     '#attributes' => array('class' => array('collapsible', 'collapsed')),
   );
-  return theme('fieldset', array('element' => $fieldset));
+  $fieldset['token_tree'] = array(
+    '#theme' => 'token_tree',
+    '#token_types' => array('node'),
+  );
+  return render($fieldset);
 }
 
 function _webform_safe_name($name) {
diff --git a/webform.tokens.inc b/webform.tokens.inc
new file mode 100644
index 0000000..2183e53
--- /dev/null
+++ b/webform.tokens.inc
@@ -0,0 +1,114 @@
+<?php
+
+/**
+ * @file
+ * Builds placeholder replacement tokens for webform-related data.
+ */
+
+/**
+ * Implements hook_token_info().
+ */
+function webform_token_info() {
+  // Webform submission tokens.
+  $info['types']['webform-submission'] = array(
+    'name' => t('Webform submission'),
+    'description' => t('Tokens related to webform submissions.'),
+    'needs-data' => 'webform-submission',
+  );
+  $info['tokens']['webform-submission']['sid'] = array(
+    'name' => t('Submission ID'),
+    'description' => t('The unique indentifier for the webform submission.'),
+  );
+  $info['tokens']['webform-submission']['node'] = array(
+    'name' => t('Node'),
+    'description' => t('The webform content that the submission came from.'),
+    'type' => 'node',
+  );
+  $info['tokens']['webform-submission']['date'] = array(
+    'name' => t('Date submitted'),
+    'description' => t('The date the webform was submitted.'),
+    'type' => 'date',
+  );
+  $info['tokens']['webform-submission']['ip-address'] = array(
+    'name' => t('IP address'),
+    'description' => t('The IP address that was used when submitting the webform.'),
+  );
+  $info['tokens']['webform-submission']['user'] = array(
+    'name' => t('Submitter'),
+    'description' => t('The user that submitted the webform result.'),
+    'type' => 'user',
+  );
+  $info['tokens']['webform-submission']['url'] = array(
+    'name' => t('URL'),
+    'description' => t('Webform tokens related to URLs.'),
+    'type' => 'url',
+  );
+  return $info;
+}
+
+/**
+ * Implements hook_tokens().
+ */
+function webform_tokens($type, $tokens, array $data = array(), array $options = array()) {
+  $replacements = array();
+
+  $url_options = array('absolute' => TRUE);
+  if (isset($options['language'])) {
+    $url_options['language'] = $options['language'];
+    $language_code = $options['language']->language;
+  }
+  else {
+    $language_code = NULL;
+  }
+
+  $sanitize = !empty($options['sanitize']);
+
+  // Webform submission tokens.
+  if ($type == 'webform-submission' && !empty($data['webform-submission'])) {
+    $submission = $data['webform-submission'];
+    foreach ($tokens as $name => $original) {
+      switch ($name) {
+        case 'sid':
+          $replacements[$original] = $submission->sid;
+          break;
+        case 'node':
+          $node = node_load($submission->nid);
+          $replacements[$original] = $sanitize ? check_plain($node->title) : $node->title;
+          break;
+        case 'date':
+          $replacements[$original] = format_date($submission->submitted, 'medium', '', NULL, $language_code);
+          break;
+        case 'ip-address':
+          $replacements[$original] = $sanitize ? check_plain($submission->remote_addr) : $submission->remote_addr;
+          break;
+        case 'user':
+          $account = user_load($submission->uid);
+          $name = format_username($account);
+          $replacements[$original] = $sanitize ? check_plain($name) : $name;
+          break;
+        case 'url':
+          $replacements[$original] = url("node/{$submission->nid}/submission/{$submission->sid}", $url_options);
+          break;
+        case 'edit-url':
+          $replacements[$original] = url("node/{$submission->nid}/submission/{$submission->sid}/edit", $url_options);
+          break;
+      }
+    }
+
+    // Chained token relationships.
+    if (($node_tokens = token_find_with_prefix($tokens, 'node')) && $node = node_load($submission->nid)) {
+      $replacements += token_generate('node', $node_tokens, array('node' => $node), $options);
+    }
+    if ($date_tokens = token_find_with_prefix($tokens, 'date')) {
+      $replacements += token_generate('date', $date_tokens, array('date' => $submission->submitted), $options);
+    }
+    if (($user_tokens = token_find_with_prefix($tokens, 'user')) && $account = user_load($submission->uid)) {
+      $replacements += token_generate('user', $user_tokens, array('user' => $account), $options);
+    }
+    if ($url_tokens = token_find_with_prefix($tokens, 'url')) {
+      $replacements += token_generate('url', $url_tokens, array('path' => url("node/{$submission->nid}/submission/{$submission->sid}", $url_options)), $options);
+    }
+  }
+
+  return $replacements;
+}
diff --git a/webform_hooks.php b/webform_hooks.php
index 6faa59f..1d7dec0 100644
--- a/webform_hooks.php
+++ b/webform_hooks.php
@@ -319,7 +319,7 @@ function hook_webform_component_info() {
       // always be displayed conditionally, regardless of this setting.
       // Defaults to TRUE.
       'conditional' => TRUE,
-      // If this field allows other fields to be grouped within it (like a 
+      // If this field allows other fields to be grouped within it (like a
       // fieldset or tabs). Defaults to FALSE.
       'group' => FALSE,
       // If this field saves a file that can be used as an e-mail attachment.
@@ -451,7 +451,7 @@ function _webform_render_component($component, $value = NULL) {
 
 /**
  * Display the result of a submission for a component.
- * 
+ *
  * The output of this function will be displayed under the "Results" tab then
  * "Submissions". This should output the saved data in some reasonable manner.
  *
@@ -569,7 +569,7 @@ function _webform_theme_component() {
 
 /**
  * Calculate and returns statistics about results for this component.
- * 
+ *
  * This takes into account all submissions to this webform. The output of this
  * function will be displayed under the "Results" tab then "Analysis".
  *
