diff --git a/README.txt b/README.txt
index 8509424..c3d29e0 100644
--- a/README.txt
+++ b/README.txt
@@ -1,20 +1,24 @@
 DESCRIPTION
 ===========
-A site holder may wish to display comments for a certain node type in a separate talk tab
+A site holder may wish to display comments for a certain node type in a
+separate talk tab.
 
-This module works with Drupal 6.x.
+This module works with Drupal 7.x.
 
 INSTALLATION
 ============
 1. Place the "talk" folder in your "sites/all/modules" directory.
-2. Enable the talk module under Administer >> Site building >>
-   Modules.
+2. Enable the talk module under Administer >> Site building >> Modules.
 3. Under Administer >> Content >> Content types, click "edit" next to the
    modules on which you wish to enable the talk tab.
-4. Enable "Display comments on separate talk page" checkbox on each content type that 
-   you'd like to have a talk tab.
+4. Enable "Display comments on separate talk page" checkbox (found under the
+   "comment settings" fieldset) on each content type that you'd like to have a
+   talk tab.
+5. If you'd like to change the text used in a variety of places go to 
+   Administer >> Settings >> Talk.  If the Token module is installed you can
+   use tokens for nodes, the current user, or the site.
 
 AUTHOR
 ======
 rötzi (http://drupal.tschannen.net/wiki/talk))
-Currently maintained by cwgordon7 (http://cwgordon.com/)
\ No newline at end of file
+Currently maintained by cwgordon7 (http://cwgordon.com/)
diff --git a/talk.info b/talk.info
index 7de5008..c4f2865 100644
--- a/talk.info
+++ b/talk.info
@@ -1,4 +1,22 @@
 name = Talk
-description = Display comments on a seperate talk page
-core = "6.x"
-dependencies[] = comment
\ No newline at end of file
+description = Display comments on a separate talk page.
+core = 7.x
+dependencies[] = comment
+
+files[] = talk.install
+files[] = talk.module
+files[] = talk.test
+files[] = talkpage.tpl.php
+
+configure = admin/config/content/talk
+
+
+; Information added by drupal.org packaging script on 2011-02-25
+version = "7.x-1.x-dev"
+core = "7.x"
+project = "talk"
+datestamp = "1298620330"
+
+
+
+
diff --git a/talk.module b/talk.module
index 5f0ba22..7422dc4 100644
--- a/talk.module
+++ b/talk.module
@@ -6,35 +6,37 @@
  */
 
 /**
- * Implementation of hook_help().
+ * Implements hook_help().
  */
 function talk_help($path, $arg) {
   switch ($path) {
     case 'admin/help#talk':
-      $output = '<p>'. t('The talk module gives you the option to display comments on a seperate tab. The option is per content type and can be set in the workflow options of a content type.') .'</p>';
+      $output = '<p>' . t('The talk module gives you the option to display comments on a separate tab. The option is per content type and can be set in the workflow options of a content type. You can control the text that shows in the tab, title, and link to the "talk" page.  You may use tokens in the patterns you set such as [title-raw], [node_comment_count], or [unread_comment_count].') . '</p>';
       return $output;
   }
 }
 
 /**
- * Implementation of hook_menu().
+ * Implements hook_menu().
  */
 function talk_menu() {
   $items = array();
   $items['node/%node/talk'] = array(
-    'title callback' => 'talk_menu_title',
+    'title callback' => 'talk_title',
+    'title arguments' => array(1),
     'page callback' => 'talk_handle',
     'page arguments' => array(1),
     'access callback' => '_talk_access',
-    'access arguments' => array('access comments', 1),
+    'access arguments' => array(1),
     'type' => MENU_LOCAL_TASK,
     'weight' => 1,
   );
-  $items['admin/settings/talk'] = array(
-    'title' => t('Talk page'),
-    'description' => t('Configure settings for the talk page.'),
+  $items['admin/config/content/talk'] = array(
+    'title' => 'Talk page',
+    'description' => 'Configure settings for the talk page.',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('talk_admin_form'),
+    'access arguments' => array('administer site configuration'),
   );
   return $items;
 }
@@ -42,95 +44,154 @@ function talk_menu() {
 /**
  * Helper item for talk_menu: access callback.
  */
-function _talk_access($perm, $node) {
-  return (user_access($perm) && talk_activated($node->type) && $node->nid && _talk_node_comment_value($node));
+function _talk_access($node) {
+  return ( $access = $node->nid && _talk_node_comment_value($node) && talk_activated($node->type) && user_access('access comments') && node_access('view', $node) && (variable_get('talk_page_no_comments', TRUE) || $node->comment_count));
 }
 
 /**
  * Menu call back for admin form.
  */
-function talk_admin_form() {
+function talk_admin_form($form, &$form_state) {
   $form = array();
-  $form['talk_title'] = array(
+  $form['talk_page'] = array(
     '#type' => 'textfield',
     '#title' => t('Title of the "talk" page'),
-    '#default_value' => talk_title(),
+    '#default_value' => talk_title(NULL, 'page'),
+    '#description' => t('If token is enabled, you can use tokens like [title-raw] or [nid].'),
   );
+  $form['talk_link'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Link from the node "links" to the "talk" page'),
+    '#default_value' => talk_title(NULL, 'link'),
+    '#description' => t('If token is enabled, you can use tokens like [title-raw] or [nid]. Leave blank to disable.'),
+  );
+  $form['talk_tab'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Link from the node "tab" to the "talk" page'),
+    '#default_value' => talk_title(NULL, 'tab'),
+    '#description' => t('This is the text displayed on the tab. If token is enabled, you can use tokens like [title-raw] or [nid].'),
+  );
+  $form['talk_page_no_comments'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Display a "talk" page if there are no comments'),
+    '#default_value' => variable_get('talk_page_no_comments', TRUE),
+    '#description' => t('If the talk page is shown when there are no comments, users will be able to add new comments from the talk page even when there are no comments; otherwise, comments will have to be added in a different method, such as via the "add new comment" link on nodes.'),
+  );
+
   return system_settings_form($form);
 }
 
-function talk_title($title = NULL) {
-  if (is_null($title)) {
-    return variable_get('talk_title', t('Talk'));
-  }
-  variable_set('talk_title', $title);
+/**
+ * Provide an appropriate title for the context.
+ *
+ * @param object $node
+ *   Optional node object.
+ * @param string $type
+ *   Optional string for context: tab, page, link.
+ * @return string
+ */
+function talk_title($node = NULL, $type = 'tab') {
+  return theme('talk_title', array('node' => $node, 'type' => $type));
 }
 
 /**
- * Menu callback for the title, as it would automatically pass args in, which would be bad.
+ * Theme function to create a talk title.
  */
-function talk_menu_title() {
-  return talk_title();
+function theme_talk_title($variables) {
+  $node = $variables['node'];
+  $type = $variables['type'];
+  $title = variable_get('talk_' . $type, t('Talk'));
+  if (module_exists('token') && isset($node->nid)) {
+    global $user;
+    $title = token_replace($title, array('global' => NULL, 'user' => $user, 'node' => $node));
+  }
+  return check_plain($title);
 }
 
 /**
  * Menu callback for talk page.
+ *
+ * @TODO: verify the comment permissions are appropriate
+ *   //COMMENT_NODE_OPEN means comments are read / write.
+ *   //COMMENT_NODE_CLOSED means comments are read only
  */
 function talk_handle($node) {
-  drupal_set_title($node->title);
-  $add_comments = _talk_node_comment_value($node) == COMMENT_NODE_READ_WRITE && user_access('post comments');
-  return theme('talkpage', $node, $add_comments);
+  drupal_set_title(check_plain(talk_title($node, 'page')));
+$add_comments = _talk_node_comment_value($node) == COMMENT_NODE_OPEN && user_access('post comments');
+  return theme('talkpage', array('node' => $node, 'add_comments' => $add_comments));
 }
 
 /**
- * Implementation of hook_nodeapi().
+ * Implements hook_node_view().
+ *
+ * @TODO: this used to be talk_link().
+ * based on comment from http://api.drupal.org/api/drupal/developer--hooks--core.php/function/hook_link/6
+ * i've done a partial conversion to hook_nood_view. still needs work
+ *
+ * @TODO: verify the comment permissions are appropriate
+ *   COMMENT_NODE_OPEN means comments are read / write.
+ *   COMMENT_NODE_CLOSED means comments are read only
  */
-function talk_nodeapi(&$node, $op) {
-  switch ($op) {
-    case 'load':
-      if (talk_activated($node->type) && arg(0) == 'node' && !arg(2)) {
-        // Overwrite setting of comment module and set comments for this node to disabled.
-        // This prevents the comments of being displayed.
-        $output['comment_original_value'] = $node->comment;
-        $output['comment'] = 0;
-        return $output;
+function talk_node_view($node, $view_mode) {
+  if (talk_activated($node->type) && user_access('access comments') && _talk_node_comment_value($node) && (arg(0) != 'comment' || arg(1) != 'reply')) {
+    $result = array();
+
+    // If there are comments, display "Talk page (X comments)" link to talk page.
+    if ($node->comment_count) {
+      $title = talk_title($node, 'link');
+      if (!empty($title)) {
+        $node->content['links']['comment']['#links']['talk_comments'] = array(
+          'title' => $title,
+          'href' => 'node/' . $node->nid . '/talk',
+          'attributes' => array(
+            'title' => t('Jump to the first comment of this posting.'),
+          ),
+        );
       }
-      break;
+    }
+    // If no comments exist, add the "Add new comment" link.
+    elseif (_talk_node_comment_value($node) == COMMENT_NODE_OPEN) {
+      if (user_access('post comments')) {
+       $node->content['links']['comment']['#links']['talk_add'] = array(
+          'title' => t('Add new comment'),
+          'fragment' => 'comment-form',
+        );
+        if (variable_get('comment_form_location_' . $node->type, COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) {
+          $node->content['links']['comment']['#links']['talk_add']['href'] = 'comment/reply/' . $node->nid;
+        }
+        else {
+          $node->content['links']['comment']['#links']['talk_add']['href'] = 'node/' . $node->nid . '/talk';
+        }
+      }
+      else {
+        $node->content['links']['comment']['#links']['talk_forbidden']['title'] = theme('comment_post_forbidden', array('node' => $node));
+        $node->content['links']['comment']['#links']['talk_forbidden']['html'] = TRUE;
+      }
+    }
+
+    return $node->content;
   }
 }
 
 /**
- * Implementation of hook_link().
+ * Implements hook_link_alter().
+ *
+ * Removes all "Add a comment" links from the comment form page.
  */
-function talk_link($type, $node = null, $teaser = false) {
-  if ($type == 'node' && talk_activated($node->type) && user_access('access comments')) {
-    $result = array();
-    if ($node->comment_count) {
-      $result['talk_view'] = array(
-        'title' => t('@title page (@nr comments)', array('@nr' => $node->comment_count, '@title' => talk_title())),
-        'href' => 'node/'. $node->nid .'/talk',
-      );
-    }
-    elseif (_talk_node_comment_value($node) == COMMENT_NODE_READ_WRITE) {
-      $result['talk_view'] = array(
-        'title' => t('Add new comment'),
-        'href' => "comment/reply/$node->nid",
-      );
-    }
-    return $result;
-  }
+function talk_node_view_alter(&$build) {
+  unset($build['links']['comment']['#links']['comment-add']);
 }
 
 /**
- * Implementation of hook_form_alter().
+ * Implements hook_form_alter().
  */
 function talk_form_alter(&$form, $form_state, $form_id) {
   // Add option to comment options of node types.
-  if ($form_id == 'node_type_form' && isset($form['identity']['type']) && module_exists('comment')) {
-    $form['workflow']['comment_talk'] = array(
+  if ($form_id == 'node_type_form' && isset($form['type']) && module_exists('comment')) {
+    $form['comment']['comment_talk'] = array(
       '#type' => 'checkbox',
       '#title' => t('Display comments on separate talk page'),
-      '#prefix' => '<strong>'. t('Talk pages:') .'</strong>',
+      '#prefix' => '<strong>' . t('Talk pages:') . '</strong>',
       '#weight' => 5,
       '#default_value' => talk_activated($form['#node_type']->type),
     );
@@ -138,35 +199,35 @@ function talk_form_alter(&$form, $form_state, $form_id) {
 }
 
 /**
- * Implementation of hook_link_alter().
+ * Implements hook_comment_insert().
+ *
+ * Changing the destination to the talk page after posting a comment.
  */
-function talk_link_alter(&$links, $node) {
-  if (talk_activated($node->type)) {
-    unset($links['comment_add']);
-  }
+function talk_comment_insert($comment) {
+    $node = node_load($comment->nid);
+    if (talk_activated($node->type)) {
+      $_GET['destination'] = 'node/' . $comment->nid . '/talk';
+    }
 }
 
 /**
- * Implementation of hook_comment()
- * Changing the destination to the talk page after posting a comment
+ * Implements hook_comment_update().
+ *
+ * Changing the destination to the talk page after updating a comment.
  */
-function talk_comment($a1, $op) {
-  if ($op == 'insert' || $op == 'update') {
-    $nid = $a1['nid'];
-    $node = node_load($nid);
+function talk_comment_update($comment) {
+  $node = node_load($comment->nid);
     if (talk_activated($node->type)) {
-      $_REQUEST['destination'] = 'node/'. $a1['nid'] .'/talk';
+      $_GET['destination'] = 'node/' . $comment->nid . '/talk';
     }
-  }
-} 
+}
+
+
 /**
- * Is talk page option activated for node tpye?
+ * Is talk page option activated for node type?
  */
-function talk_activated($node_type, $value = NULL) {
-  if (is_null($value)) {
-    return variable_get('comment_talk_'. $node_type, FALSE);
-  }
-  variable_set('comment_talk_'. $node_type, $value);
+function talk_activated($node_type) {
+  return variable_get('comment_talk_' . $node_type, FALSE);
 }
 
 /**
@@ -175,41 +236,115 @@ function talk_activated($node_type, $value = NULL) {
 function _talk_node_comment_value(&$node) {
   return isset($node->comment_original_value) ? $node->comment_original_value : $node->comment;
 }
- 
- /**
-  * Implementation of hook_theme().
-  */
+
+/**
+ * Implements hook_theme().
+ */
 function talk_theme() {
   return array(
     'talkpage' => array(
       'template' => 'talkpage',
-      'arguments' => array('node' => NULL, 'add_comments' => NULL),
+      'variables' => array('node' => NULL, 'add_comments' => NULL),
+    ),
+    'talk_comments' => array(
+      'function' => 'theme_talk_comments',
+      'variables' => array('node' => NULL),
+    ),
+    'talk_title' => array(
+      'function' => 'theme_talk_title',
+      'variables' => array('node' => NULL, 'type' => 'tab'),
     ),
   );
 }
 
 /**
- * Theme talkpage for node
+ * Implementation of hook_preprocess().
+ * 
+ * if we are on the "view" tab, remove the comments.
+ *
+ */
+function talk_preprocess(&$variables, $hook) {
+   if (isset($variables['node']->type) && $hook == 'page') {
+    $activated = talk_activated($variables['node']->type);
+    if ($activated && arg(0) == 'node' && !arg(2)) {
+      //unset( $variables['page']['content']['system_main']['content']['nodes'][arg(1)]['comments']);
+      unset( $variables['page']['content']['system_main']['nodes'][arg(1)]['comments']);
+    }
+  }
+
+}
+
+/**
+ * Template preprocess function.
+ *
  * @param $node
- *   node whose talk page is displayed
+ *   The node whose talk page is being displayed.
  * @param $add_comments
- *   boolean which indicates if the adding of comments is allowed for current user
+ *   Boolean that indicates if adding comments is allowed for current user.
  * @ingroup themeable
  */
 function template_preprocess_talkpage(&$variables) {
   $add_comments = $variables['add_comments'];
   $node = $variables['node'];
-  $variables['title'] = talk_title();
+  $variables['title'] = talk_title($node, 'page');
   $comment_link = '';
-  if ($add_comments) {
-    $comment_link = l(t('Add new comment'), "comment/reply/$node->nid");
-  }
-  $comments = comment_render($node, 0);
   $redisplay = FALSE;
-  if ($node->comment_count > 1 && $add_comments) {
-    $redisplay = TRUE;
+
+  if ($add_comments) {
+    if (variable_get('comment_form_location_' . $node->type, COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) {
+      $comment_link = l(t('Add new comment'), 'comment/reply/' . $node->nid, array('fragment' => 'comment-form'));
+    }
+    elseif ($node->comment_count > 1) {
+      $comment_link = l(t('Add new comment'), check_plain($_GET['q']), array('fragment' => 'comment-form'));
+      $redisplay = TRUE;
+    }
   }
+
+  $comments = theme('talk_comments', array('node' => $node));
+
   $variables['redisplay'] = $redisplay;
   $variables['comment_link'] = $comment_link;
   $variables['comments'] = $comments;
-}
\ No newline at end of file
+}
+
+/**
+ *  A theme function to provide flexible rendering of the comments.
+ *
+ *  @param $variables
+ *    The list of $variables so we can extract the node whose talk page is being displayed.
+ */
+function theme_talk_comments($variables) {
+  return drupal_render(comment_node_page_additions($variables['node']));
+}
+
+/**
+ * Implements hook_token_list(). Documents the individual().
+ * tokens handled by the module.
+ */
+function talk_token_list($type = 'all') {
+  $tokens = array();
+  if ($type == 'comment' || $type == 'all') {
+    $tokens['comment']['comment-talk-url'] = t('The comment view url (Talk compatible).');
+  }
+  return $tokens;
+}
+
+/**
+ * Implements hook_token_values().
+ */
+function talk_token_values($type, $object = NULL, $options = array()) {
+  switch ($type) {
+    case 'comment':
+      if ($comment = (object) $object) {
+        $talk = '';
+        $node = node_load($comment->nid);
+        if (talk_activated($node->type)) {
+          $talk = '/talk';
+        }
+        $values['comment-talk-url'] = url('node/' . $comment->nid . $talk, array('fragment' => 'comment-' . $comment->cid, 'absolute' => TRUE));
+        return $values;
+      }
+      break;
+  }
+}
+
diff --git a/talkpage.tpl.php b/talkpage.tpl.php
index e816cf3..430536c 100644
--- a/talkpage.tpl.php
+++ b/talkpage.tpl.php
@@ -1,6 +1,9 @@
-<?php /* $Id$ */ ?>
+<?php // $Id$ ?>
 <?php
 /**
+ * @file
+ * Overridable template file for talk page.
+ *
  * Available variables:
  *   $node represents the node whose comments we're displaying.
  *   $comments represents the rendered comments.
@@ -10,12 +13,14 @@
  *   $title represents the title of the talk page. Defaults to "Talk".
  */
 ?>
-<p>
-<?php print $comment_link; ?>
-</p>
-<br />
+<?php if ($comment_link): ?>
+  <p>
+    <?php print $comment_link; ?>
+  </p>
+  <br />
+<?php endif; ?>
 <?php print $comments; ?>
-<?php if ($redisplay): ?>
+<?php if ($comment_link && $redisplay): ?>
   <p>
   <?php print $comment_link; ?>
   </p>
