diff -urp taxonomy_access/taxonomy_access.install taxonomy_access_new/taxonomy_access.install
--- taxonomy_access/taxonomy_access.install	2010-03-14 20:15:18.000000000 -0500
+++ taxonomy_access_new/taxonomy_access.install	2010-03-14 20:04:14.000000000 -0500
@@ -3,67 +3,30 @@
 
 /**
  * @file
- *  Implementations of hook_update (called by update.php)
+ *  Install, update, and uninstall functions for Taxonomy Access Control.
  */
 
-// Update#1: updating the tables to UTF-8
-function taxonomy_access_update_1() {
-  return _system_update_utf8(array('term_access', 'term_access_defaults'));
-}
-
-// Update#2: adding field 'grant_list' to tables 'term_access' and 'term_access_defaults'.
-function taxonomy_access_update_2() {
-  switch ($GLOBALS['db_type']) {
-    case 'pgsql':
-      // Checking if column 'grant_list' exists
-      if (db_result(db_query("SELECT a.attname FROM {pg_attribute} a LEFT JOIN {pg_class} c ON c.oid = a.attrelid WHERE c.relname = 'term_access' AND a.attname = 'grant_list'"))) {
-        drupal_set_message(t("Taxonomy Access - Update #2: No queries executed. Field 'grant_list' already exists in tables 'term_access'."), 'error');
-        $ret = array();
-      }
-      else {
-        $ret[] = update_sql("ALTER TABLE {term_access} ADD grant_list smallint");
-        $ret[] = update_sql("ALTER TABLE {term_access} ALTER COLUMN grant_list SET DEFAULT '0'");
-        $ret[] = update_sql("ALTER TABLE {term_access} ALTER COLUMN grant_list SET NOT NULL ");
-        $ret[] = update_sql("UPDATE {term_access} SET grant_list = grant_view");
-        $ret[] = update_sql("ALTER TABLE {term_access_defaults} ADD grant_list smallint");
-        $ret[] = update_sql("ALTER TABLE {term_access_defaults} ALTER COLUMN grant_list SET DEFAULT '0");
-        $ret[] = update_sql("ALTER TABLE {term_access_defaults} ALTER COLUMN grant_list SET NOT NULL ");
-        $ret[] = update_sql("UPDATE {term_access_defaults} SET grant_list = grant_view");
-      }
-      break;
 
-    case 'mysql':
-    case 'mysqli':
-      // Checking if column 'grant_list' exists
-      if (db_result(db_query("DESC {term_access} 'grant_list'"))) {
-        drupal_set_message(t("Taxonomy Access - Update #2: No queries executed. Field 'grant_list' already exists in tables 'term_access'."), 'error');
-        $ret = array();
-      }
-      else {
-        $ret[] = update_sql("ALTER TABLE {term_access} ADD grant_list TINYINT(1) UNSIGNED DEFAULT '0'  NOT NULL");
-        $ret[] = update_sql("UPDATE {term_access} SET grant_list = grant_view");
-        $ret[] = update_sql("ALTER TABLE {term_access_defaults} ADD grant_list TINYINT(1) UNSIGNED DEFAULT '0'  NOT NULL");
-        $ret[] = update_sql("UPDATE {term_access_defaults} SET grant_list = grant_view");
-      }
-      break;
-  }
-
-  return $ret;
+/**
+ * Implements hook_update_last_removed().
+ */
+function taxonomy_access_last_removed() {
+  return 3;
 }
 
-function taxonomy_access_update_3() {
-  // new module weights in core: put taxonomy_access to the bottom (but before the very last ones) in the chain.
-  $ret[] = update_sql("UPDATE {system} SET weight = 9 WHERE name = 'taxonomy_access'");
-  return $ret;
-}
 
-// Update#4: Delete variable 'taxonomy_access_enabled'
+/**
+ * Delete variable 'taxonomy_access_enabled'.
+ */
 function taxonomy_access_update_4() {
   variable_del('taxonomy_access_enabled');
   return array();
 }
 
-// Update#5: Move global default records from term_access to term_access defaults
+
+/**
+ * Move global default records from term_access to term_access_defaults.
+ */
 function taxonomy_access_update_5() {
   $result = db_query('SELECT rid, grant_view, grant_update, grant_delete, grant_create, grant_list FROM {term_access} WHERE tid=0');
   while ($row = db_fetch_array($result)) {
@@ -74,14 +37,16 @@ function taxonomy_access_update_5() {
       }
       $row_ints = implode(", ", $row);
       update_sql('INSERT INTO {term_access_defaults} (vid, rid, grant_view, grant_update, grant_delete, grant_create, grant_list) VALUES (0, $row_ints)');
-    } 
+    }
   }
   update_sql('DELETE FROM {term_access} WHERE tid=0');
   return array();
 }
+
+
 /**
- * Implementation of hook_install.
- * Adding tables to database: 'term_access', 'term_access_defaults'
+ * Implements hook_install().
+ * Adds tables to database: 'term_access', 'term_access_defaults'
  */
 function taxonomy_access_install() {
   switch ($GLOBALS['db_type']) {
@@ -104,7 +69,7 @@ function taxonomy_access_install() {
       }
       break;
 
-  } // End case 
+  }
 
   // Use Schema API to install tables.
   $status = drupal_install_schema('taxonomy_access');
@@ -122,8 +87,8 @@ function taxonomy_access_install() {
 
   // Weight taxonomy_access below most modules, but above the very last ones.
   db_query("UPDATE {system} SET weight = 9 WHERE name = 'taxonomy_access'");
-      
-  // Notify of changes
+
+  // Notify user of status.
   if ($success) {
     drupal_set_message(t('Taxonomy Access module installed tables successfully.'));
   }
@@ -132,11 +97,16 @@ function taxonomy_access_install() {
   }
 }
 
+
+/**
+ * Implements hook_uninstall().
+ */
 function taxonomy_access_uninstall() {
   drupal_uninstall_schema('taxonomy_access');
   drupal_set_message(t('Taxonomy Access has been successfully uninstalled.'));
 }
 
+
 /**
  * Implements hook_schema().
  */
diff -urp taxonomy_access/taxonomy_access.module taxonomy_access_new/taxonomy_access.module
--- taxonomy_access/taxonomy_access.module	2010-03-14 20:15:18.000000000 -0500
+++ taxonomy_access_new/taxonomy_access.module	2010-03-14 20:17:05.000000000 -0500
@@ -1,5 +1,5 @@
 <?php
-// $Id: taxonomy_access.module,v 1.107.2.17 2010/03/14 15:15:54 xjm Exp $
+// $Id: taxonomy_access.module,v 1.107.2.16 2010/03/13 15:22:03 xjm Exp $
 // Based on original taxonomy_access.module made by pyromanfo
 
 /**
@@ -14,7 +14,7 @@
 define('TAXONOMY_ACCESS_MAX_UPDATE', 500);
 
 /**
- * Implementation of hook_help
+ * Implements hook_help().
  */
 function taxonomy_access_help($path, $arg) {
   switch ($path) {
@@ -38,24 +38,24 @@ function taxonomy_access_help($path, $ar
         . '<h3 id="perm">' . t("Permission options") . "</h3>"
         . '<p>'. t('<strong><em>View</em>, <em>Update</em>, and <em>Delete</em> have three options for each term:</strong> <em>Allow</em> (<acronym title="Allow">A</acronym>), <em>Ignore</em> (<acronym title="Ignore">I</acronym>), and <em>Deny</em> (<acronym title="Deny">D</acronym>).  Indicate which rights each role should have for each term.  If a node is tagged with multiple terms:') .'</p>'
         . "<ul>\n"
-        . "<li>" 
-        . t('<em>Deny</em> (<acronym title="Deny">D</acronym>) overrides <em>Allow</em> (<acronym title="Allow">A</acronym>) within a role.') 
+        . "<li>"
+        . t('<em>Deny</em> (<acronym title="Deny">D</acronym>) overrides <em>Allow</em> (<acronym title="Allow">A</acronym>) within a role.')
         . "</li>"
-        . "<li>" 
-        . t('Both <em>Allow</em> (<acronym title="Allow">A</acronym>) and <em>Deny</em> (<acronym title="Deny">D</acronym>) override <em>Ignore</em> (<acronym title="Ignore">I</acronym>) within a role.') 
+        . "<li>"
+        . t('Both <em>Allow</em> (<acronym title="Allow">A</acronym>) and <em>Deny</em> (<acronym title="Deny">D</acronym>) override <em>Ignore</em> (<acronym title="Ignore">I</acronym>) within a role.')
     . "</li>"
-        . "<li>" 
-        . t('If a user has <strong>multiple roles</strong>, an <em>Allow</em> (<acronym title="Allow">A</acronym>) from one role <strong>will</strong> override a <em>Deny</em> (<acronym title="Deny">D</acronym>) in another.  (For more information, see section <a href="#good-to-know">Good to know</a> below.)') 
+        . "<li>"
+        . t('If a user has <strong>multiple roles</strong>, an <em>Allow</em> (<acronym title="Allow">A</acronym>) from one role <strong>will</strong> override a <em>Deny</em> (<acronym title="Deny">D</acronym>) in another.  (For more information, see section <a href="#good-to-know">Good to know</a> below.)')
         . "</li>"
         . "</ul>\n\n"
         . '<p>'. t('<strong><em>Create</em> and <em>List</em> have only two options for each term:</strong>  <em>Yes</em> (selected) or <em>No</em> (deselected).  Indicate what each role should be allowed to do with each term.') .'</p>'
         . "<h4>" . t("Important notes") . "</h4>"
         . "<ol>"
-        . "<li>" . t('Custom roles <strong>will</strong> inherit permissions from the <em>authenticated user</em> role.  Be sure to <a href="@url">configure
+        . "<li>"
+        . t('Custom roles <strong>will</strong> inherit permissions from the <em>authenticated user</em> role.  Be sure to <a href="@url">configure
 the authenticated user</a> properly.',
-          array("@url" => url("admin/user/taxonomy_access/edit/2"))
-           )
-        . "</li\n"
+          array("@url" => url("admin/user/taxonomy_access/edit/2")))
+        . "</li>\n"
         . '<li>'
         . "<p>" . t('The <em>Deny</em> directives are processed after the <em>Allow</em> directives. (<strong><em>Deny</em> overrides <em>Allow</em></strong>.)</em>  So, if a multicategory node is in Categories "A" and "B" and a user has <em>Allow</em> permissions for <em>View</em> in Category "A" and <em>Deny</em> permissions for <em>View</em> in Category "B", then the user will NOT be permitted to <em>View</em> the node.') . '</p>'
         . '<p>' . t('<em>Access is denied by default.</em> So, if a multicategory node is in Categories "C" and "D" and a user has <em>Ignore</em> permissions for <em>View</em> in both Category "C" and "D", then the user will <strong>not</strong> be permitted to view the node.') . '</p>'
@@ -83,7 +83,7 @@ the authenticated user</a> properly.',
 }
 
 /**
- * Implementation of hook_enable().
+ * Implements hook_enable().
  *
  * Housekeeping: while we were away, did you delete any terms/vocabs/roles?
  * 1: delete ta rows for missing terms
@@ -96,8 +96,11 @@ function taxonomy_access_enable() {
   switch ($db_type) {
     case 'mysql':
     case 'mysqli':
-      // TODO: Test our PostgreSQL code with MySQL and replace this DB-specific
-      //       code with it, if it works.
+      /**
+       * @todo
+       *     Test our PostgreSQL code with MySQL and replace this DB-specific
+       *     code with it, if it works.
+       */
       db_query('DELETE ta FROM {term_access} ta LEFT JOIN {term_data} td ON ta.tid = td.tid WHERE ta.tid <> 0 AND ISNULL(td.tid)');
       db_query('DELETE tad FROM {term_access_defaults} tad LEFT JOIN {vocabulary} v ON tad.vid = v.vid WHERE tad.vid <> 0 AND ISNULL(v.vid)');
       db_query('DELETE ta FROM {term_access} ta LEFT JOIN {role} r ON ta.rid = r.rid WHERE ISNULL(r.rid)');
@@ -118,7 +121,7 @@ function taxonomy_access_enable() {
               db_query("DELETE FROM {term_access} WHERE tid = %d AND rid = %d", $args);
             }
             else {
-              db_query("DELETE FROM {term_access_defaults} WHERE vid = %d AND rid = %d", $args);        
+              db_query("DELETE FROM {term_access_defaults} WHERE vid = %d AND rid = %d", $args);
             }
           }
         }
@@ -128,22 +131,27 @@ function taxonomy_access_enable() {
 }
 
 /**
- * Implementation of hook_node_grants()
- * Gives access to taxonomies based on the taxonomy_access table
+ * Implements hook_node_grants().
+ * Gives access to taxonomies based on the taxonomy_access table.
  */
 function taxonomy_access_node_grants($user, $op) {
   return array('term_access' => array_keys(is_array($user->roles) ? $user->roles : array(1 => 'anonymous user')));
 }
 
 /**
- * Implementation of hook_node_access_records().
- * TODO: change query to behave properly when no term or vocab record is present
+ * Implements hook_node_access_records().
+ *
+ * @todo
+ *    Get query to behave properly when no term or vocab record is present.
  */
 function taxonomy_access_node_access_records($node) {
   $grants = array();
 
   if (is_array($node->taxonomy) AND count($node->taxonomy)) {
-    // TODO: how does deny/ignore work with this?
+    /**
+     * @todo
+     *    How does deny/ignore work with this?
+     */
     $result = db_query('SELECT tadg.rid, 
                        BIT_OR(COALESCE( ta.grant_view, tad.grant_view, tadg.grant_view )) AS grant_view, 
                        BIT_OR(COALESCE( ta.grant_update, tad.grant_update, tadg.grant_update )) AS grant_update, 
@@ -161,11 +169,12 @@ function taxonomy_access_node_access_rec
     $result = db_query('SELECT n.nid, tadg.rid AS rid, tadg.grant_view AS grant_view, tadg.grant_update AS grant_update, tadg.grant_delete AS grant_delete 
                        FROM {node} n INNER JOIN {term_access_defaults} tadg ON tadg.vid = 0 
                        WHERE n.nid = %d', $node->nid);
-  }  
-  // A bit of explanation for future generations regarding the deny/allow override behavior:
-  // only a value of '1' is considered an 'allow'. Ignore (really a weak deny) is '0', deny is '2' ('10' in binary). 
-  // Allow always gets through the BIT_OR above as '1', unless a deny is present, in which case the value will be '3' ('11' in binary)
+  }
 
+  // Ignore => 0, Allow => 1, Deny => 2 ('10' in binary).
+  // Only a value of 1 is considered an 'Allow';
+  // with an 'Allow' and no 'Deny', the value from the BIT_OR will be 1.
+  // If a 'Deny' is present, the value will then be 3 ('11' in binary).
   while ($row = db_fetch_array($result)) {
     $grants[] = array(
       'realm' => 'term_access',
@@ -181,7 +190,7 @@ function taxonomy_access_node_access_rec
 }
 
 /**
- * Implementation of hook_init
+ * Implements hook_init().
  */
 function taxonomy_access_init() {
   if (arg(0) == 'admin') {
@@ -193,7 +202,7 @@ function taxonomy_access_init() {
 }
 
 /**
- * Implementation of hook_theme().
+ * Implements hook_theme().
  */
 function taxonomy_access_theme() {
   return array(
@@ -204,7 +213,7 @@ function taxonomy_access_theme() {
 }
 
 /**
- * Implementation of hook_menu
+ * Implements hook_menu().
  */
 function taxonomy_access_menu() {
   $items = array();
@@ -232,12 +241,16 @@ function taxonomy_access_menu() {
 }
 
 /**
- * Implementation of hook_form_alter()
+ * Implements hook_form_alter().
+ *
+ * @todo
+ *     Move control of "create" op here
+ * @todo
+ *     Look at feasability to eliminate _restore_terms and _preserve_terms
+ *     by simply setting the '#access' attribute for those terms.
  */
 function taxonomy_access_form_alter(&$form, &$form_state, $form_id) {
-  //TODO: Move control of "create" op here
-  //TODO: look at feasability to eliminate _restore_terms and _preserve_terms by simply setting the '#access' attribute for those terms
-  if ($form['#id'] == 'node-form' && is_numeric($form['nid']['#value'])) { 
+  if ($form['#id'] == 'node-form' && is_numeric($form['nid']['#value'])) {
     $form['tac_protected_terms'] = array(
       '#type' => 'value',
       '#value' => taxonomy_access_preserve_terms($form['#node'])
@@ -249,7 +262,7 @@ function taxonomy_access_form_alter(&$fo
 /**
  * Implements hook_form_FORM_ID_alter() for taxonomy-form-term.
  * Overriding the term deletion form's submit handler allows us to determine
- * which {node_access} entries must be updated before the {term_data} and 
+ * which {node_access} entries must be updated before the {term_data} and
  * {term_node} records are deleted from the database.
  */
 function taxonomy_access_form_taxonomy_form_term_alter(&$form, &$form_state) {
@@ -258,8 +271,8 @@ function taxonomy_access_form_taxonomy_f
 
 /**
  * Implements hook_form_FORM_ID_alter() for taxonomy-vocabulary-confirm-delete.
- * Overriding the vocabulary deletion form's submit handler allows us to 
- * determine which {node_access} entries must be updated before the 
+ * Overriding the vocabulary deletion form's submit handler allows us to
+ * determine which {node_access} entries must be updated before the
  * {term_data} and {term_node} records are deleted from the database.
  */
 function taxonomy_access_form_taxonomy_vocabulary_confirm_delete_alter(&$form, &$form_state) {
@@ -270,6 +283,9 @@ function taxonomy_access_form_taxonomy_v
 /**
  * Submit handler for term deletions.
  * Overrides term deletion handling to determine what node access to update.
+ *
+ * @return
+ *     Confirmation form, or nothing, as appropriate.
  */
 function taxonomy_access_term_submit(&$form, &$form_state) {
   // If we are deleting a term, override the default behavior.
@@ -282,9 +298,9 @@ function taxonomy_access_term_submit(&$f
       _taxonomy_access_del_term($tid);
 
       // Determine which nodes belong to this term and its children and cache.
-      $affected_nodes = _taxonomy_access_get_nodes_for_term($tid, TRUE); 
+      $affected_nodes = _taxonomy_access_get_nodes_for_term($tid, TRUE);
       _taxonomy_access_cache_affected_nodes($affected_nodes);
-      
+
       // Proceed with term deletion.
       return taxonomy_term_confirm_delete_submit($form, $form_state);
     }
@@ -299,7 +315,6 @@ function taxonomy_access_term_submit(&$f
   else {
     taxonomy_form_term_submit($form, $form_state);
   }
-    
 }
 
 /**
@@ -313,20 +328,23 @@ function taxonomy_access_vocabulary_dele
   // Determine which nodes belong to this vocabulary and cache.
   $affected_nodes = _taxonomy_access_get_nodes_for_vocabulary($vid);
   _taxonomy_access_cache_affected_nodes($affected_nodes);
-  
+
   // Proceed with vocabulary deletion.
   return taxonomy_vocabulary_confirm_delete_submit($form, $form_state);
 }
 
 /**
- * Implementation of hook_nodeapi().
+ * Implements hook_nodeapi().
  */
 function taxonomy_access_nodeapi(&$node, $op, $arg = 0) {
   switch ($op) {
     case 'presave':
       // When TAC grants 'update' access to edit node,
-      // Changing $node->uid back to original creator (changed by node_submit)
-      // TODO: do we still need this? (with node_revisions table etc)
+      // change $node->uid back to original creator (changed by node_submit).
+      /**
+       * @todo
+       *     Do we still need this? (with node_revisions table etc.)
+       */
       if (($node->nid) && !user_access('administer nodes') && (node_access('update', $node))) {
         // Populate the "authored by" field.
         $old_node = node_load($node->nid);
@@ -353,9 +371,8 @@ function taxonomy_access_nodeapi(&$node,
 }
 
 /**
- * Implementation of hook_taxonomy
- * Hook_taxonomy is called when changes are made to the taxonomy structure
-**/
+ * Implements hook_taxonomy().
+ */
 function taxonomy_access_taxonomy($op, $type, $array = NULL) {
   switch ($op) {
     case 'delete':
@@ -367,7 +384,7 @@ function taxonomy_access_taxonomy($op, $
       static $del_term;
       static $affected_nodes;
       static $descendants;
-      
+
       // Check for flags & node list from our admin form submit overrides.
       if (!isset($del_vocab)) {
         $del_vocab = _taxonomy_access_del_vocabulary();
@@ -388,14 +405,14 @@ function taxonomy_access_taxonomy($op, $
           $array['tid']);
       }
       if ($type == 'vocabulary') {
-        db_query("DELETE FROM {term_access_defaults} WHERE vid = '%d'", 
+        db_query("DELETE FROM {term_access_defaults} WHERE vid = '%d'",
           $array['vid']);
       }
-      
+
       // Determine if and how to update node access.
 
       // If the user deleted a vocabulary on the admin form, use cached data.
-      if ($del_vocab) { 
+      if ($del_vocab) {
 
         // Only trigger node access update on the vocab deletion itself,
         // after all the terms have been deleted.
@@ -403,25 +420,25 @@ function taxonomy_access_taxonomy($op, $
           _taxonomy_access_node_access_update($affected_nodes);
         }
       }
-      
+
       // If the user deleted a term on the admin form, use cached data.
       elseif ($del_term) {
-        /** 
-         * Main term is first one to invoke the hook.
-         * To ensure that update runs only once after all descendants have
-         * been processed, unset each when it invokes the hook.
-         */
+
+        // Main term is first one to invoke the hook.
+        // To ensure that update runs only once after all descendants have
+        // been processed, unset each when it invokes the hook.
+
         $key = array_search($array['tid'], $descendants);
         if (!($key === FALSE)) { // Might be zero.
           unset($descendants[$key]);
         }
-        
+
         // If there are no descendants left, process updates.
         if (sizeof($descendants) == 0) {
           _taxonomy_access_node_access_update($affected_nodes);
         }
       }
-        
+
       // Otherwise, we don't know which nodes are affected,
       // so indicate that node access needs to be rebuilt.
       else {
@@ -435,7 +452,7 @@ function taxonomy_access_taxonomy($op, $
 }
 
 /**
- * Implementation of hook_db_rewrite_sql()
+ * Implements hook_db_rewrite_sql().
  */
 function taxonomy_access_db_rewrite_sql($query, $table, $field) {
   if (!user_access('administer taxonomy') && ($field =='vid' || $field =='tid')) {
@@ -452,27 +469,23 @@ function taxonomy_access_db_rewrite_sql(
     if (!isset($taxonomy_access_sql_clause[$op][$field]))  {
       if (isset($user) && is_array($user->roles)) {
         $rids = array_keys($user->roles);
-      } 
+      }
       else {
         $rids[] = 1;
       }
 
-      $sql = db_query('SELECT t.tid AS tid, t.vid AS vid FROM {term_data} t
-                      INNER JOIN {term_access_defaults} tdg ON tdg.vid=0
-                      LEFT JOIN {term_access_defaults} td 
-                        ON td.vid=t.vid AND td.rid=tdg.rid
-                      LEFT JOIN {term_access} ta 
-                        ON ta.tid=t.tid AND ta.rid=tdg.rid
-                      WHERE tdg.rid IN (' . db_placeholders($rids, 'int') .')
-                      GROUP BY t.tid, t.vid 
-                        HAVING BIT_OR(
-                          COALESCE(
-                            ta.' . db_escape_table("grant_$op") . ', 
-                            td.' . db_escape_table("grant_$op") . ',
-                            tdg.' . db_escape_table("grant_$op") . '
-                          )
-                        ) > 0',
-                     $rids);
+      $sql = db_query(
+        'SELECT t.tid AS tid, t.vid AS vid FROM {term_data} t
+         INNER JOIN {term_access_defaults} tdg ON tdg.vid=0
+         LEFT JOIN {term_access_defaults} td ON td.vid=t.vid AND td.rid=tdg.rid
+         LEFT JOIN {term_access} ta ON ta.tid=t.tid AND ta.rid=tdg.rid
+         WHERE tdg.rid IN (' . db_placeholders($rids, 'int') .')
+         GROUP BY t.tid, t.vid 
+         HAVING BIT_OR(COALESCE(
+                                ta.' . db_escape_table("grant_$op") . ', 
+                                td.' . db_escape_table("grant_$op") . ',
+                                tdg.' . db_escape_table("grant_$op") . '
+                               )) > 0', $rids);
 
       $tids = array();
       $vids = array();
@@ -508,13 +521,13 @@ function taxonomy_access_db_rewrite_sql(
 
     $return = array();
     if ($clause[$op][$field]) {
-      $return['where'] = 
-        db_escape_table($table) . "." . db_escape_table($field) 
+      $return['where'] =
+        db_escape_table($table) . "." . db_escape_table($field)
         . " IN ('". $clause[$op][$field] ."')";
     }
     else {
-      $return['where'] = 
-        db_escape_table($table) . "." . db_escape_table($field) 
+      $return['where'] =
+        db_escape_table($table) . "." . db_escape_table($field)
         . " IS NULL";
     return $return;
     }
@@ -525,19 +538,19 @@ function taxonomy_access_db_rewrite_sql(
 }
 
 /**
- * used to preserve terms deleted by taxonomy_node_delete() 
+ * Used to preserve terms deleted by taxonomy_node_delete()
  * that the user shouldn't have access to delete.
- * see http://drupal.org/node/92355 and http://drupal.org/node/93086
+ * See http://drupal.org/node/92355 and http://drupal.org/node/93086
  *
- * Called by hook_form_alter()
- */  
- // TODO: should be possible to replace this with #access per term-field
+ * @todo
+ *     Should be possible to replace this with #access per term-field.
+ */
 function taxonomy_access_preserve_terms($node) {
   $nid = $node->nid;
 
   // prepare/cache return value
   static $tids = array();
-  
+
   // a valid numeric nid is required
   if (!is_numeric($nid)) {
     return array();
@@ -547,14 +560,14 @@ function taxonomy_access_preserve_terms(
   if (isset($tids[$nid])) {
     return $tids[$nid];
   }
-  
+
   // get a list of terms this user has access to/over
   // (invokes hook_db_rewrite_sql() to limit access)
   $user_terms = taxonomy_node_get_terms($node);
 
   // get a list of all terms this node is in regardless of user's
   // access settings. Don't use db_rewrite_sql() api call here (or
-  // any other API call, the taxonomy API functions all use 
+  // any other API call, the taxonomy API functions all use
   // db_rewrite_sql() so we must query the database tables directly)
   $result = db_query('SELECT tid FROM {term_node} WHERE vid = %d', $node->vid);
   $tids[$nid] = array();
@@ -564,18 +577,16 @@ function taxonomy_access_preserve_terms(
       $tids[$nid][$row['tid']] = $row['tid'];
     }
   }
-  
+
   // return only terms current user does not have access
   // to and therefore need restoring after edit/update
   return $tids[$nid];
 }
 
 /**
- * used to restore terms deleted by taxonomy_node_delete() 
+ * Used to restore terms deleted by taxonomy_node_delete()
  * that the user shouldn't have access to delete.
- * see http://drupal.org/node/92355 and http://drupal.org/node/93086
- *
- * Called by taxonomy_access_nodeapi()
+ * See http://drupal.org/node/92355 and http://drupal.org/node/93086
  */
 function taxonomy_access_restore_terms($nid, $vid, $protected_terms) {
   if (isset($protected_terms)) {
@@ -599,15 +610,17 @@ function taxonomy_access_restore_terms($
 }
 
 /**
- * Gets permissions for a given role
+ * Gets permissions for a given role.
+ *
  * @param $rid
  *   The role id to retrieve the permissions for.
+ *
  * @return
  *   A two dimensional hash of the form $grants[tid][grant] where
- *   tid is the term id and
- *   grant is the permission (i.e. 'view','delete',ect.)
- *   this entry in the hash is true if permission is granted, false otherwise
-**/
+ *   tid is the term id and grant is the permission
+ *   ('view','delete', etc.).
+ *   This entry in the hash is true if permission is granted, false otherwise.
+ */
 function taxonomy_access_get_grants($rid) {
   if (!isset($rid)) {
     return FALSE;
@@ -633,15 +646,17 @@ function taxonomy_access_get_grants($rid
   return $grants;
 }
 /**
- * Gets default permissions for a given role
+ * Gets default permissions for a given role.
+ *
  * @param $rid
  *   The role id to retrieve the permissions for.
+ *
  * @return
  *   A two dimensional hash of the form $grants[vid][grant] where
  *   vid is the vocab id and
  *   grant is the permission (i.e. 'view','delete',ect.)
  *   this entry in the hash is true if permission is granted, false otherwise
-**/
+ */
 function taxonomy_access_get_default_grants($rid) {
   if (!is_numeric($rid)) {
     return FALSE;
@@ -669,7 +684,7 @@ function taxonomy_access_get_default_gra
  * Get term IDs for all descendants of the given term.
  * @param $tid
  *    The term ID for which to fetch children
- * @return $descendants
+ * @return
  *    An array of the IDs of the term's descendants.
  */
 function _taxonomy_access_get_descendants($tid) {
@@ -679,7 +694,7 @@ function _taxonomy_access_get_descendant
     $descendants[$tid] = array();
     $term = taxonomy_get_term($tid);
     $tree = taxonomy_get_tree($term->vid, $tid);
-    
+
     foreach ($tree as $term) {
       $descendants[$tid][] = $term->tid;
     }
@@ -688,23 +703,24 @@ function _taxonomy_access_get_descendant
 }
 
 /**
- * Gets node ids associated with a given term
+ * Gets node ids associated with a given term.
+ *
  * @param $tid
- *    The term id for which to retrieve associated nodes
+ *    The term id for which to retrieve associated nodes.
  * @param $get_children
- *    Whether to recursively get nodes tagged with children of the term as well
- * @return $nids
- *    An array of node ids associated with the given term
+ *    Whether to recursively get nodes tagged with the term's children as well.
+ *
+ * @return
+ *    An array of node ids associated with the given term.
  */
 function _taxonomy_access_get_nodes_for_term($tid, $get_children = FALSE) {
   $nids = array();
-  
-  // @todo Join on term access as in vocab so we update fewer nodes?
+
   $result = db_query("SELECT nid FROM {term_node} WHERE tid = %d", $tid);
   while ($node = db_fetch_object($result)) {
     $nids[] = $node->nid;
   }
-  
+
   // If requested, get nodes tagged with all children as well.
   if ($get_children) {
     $child_tids = _taxonomy_access_get_descendants($tid);
@@ -729,16 +745,16 @@ function _taxonomy_access_get_nodes_for_
  *    The vocabulary id for which to retrieve associated node ids.
  * @param $rid
  *    The role id for which to retrieve node ids, if any.
- *    This argument has the effect of filtering out nodes in terms that 
+ *    This argument has the effect of filtering out nodes in terms that
  *    are already controlled invidually for the role.
  *
- * @return $nid
+ * @return
  *    An array of node ids associated with the given vocabulary.
  */
 function _taxonomy_access_get_nodes_for_vocabulary($vid, $rid = NULL) {
   $nids = array();
 
-  $query = 
+  $query =
     "SELECT n.nid FROM {term_node} n
       LEFT JOIN {term_data} d ON n.tid = d.tid
       WHERE d.vid = %d ";
@@ -755,16 +771,16 @@ function _taxonomy_access_get_nodes_for_
     while ($row = db_fetch_object($r)) {
       $tids[] = $row->tid;
     }
-    
+
     if (!empty($tids)) {
       // Exclude nodes with those terms from the results.
-      $query .= 
+      $query .=
         " AND n.tid NOT IN (" . db_placeholders($tids, 'int') . ")";
       $args = array_merge($args, $tids);
     }
   }
   $result = db_query($query, $args);
-  
+
   while ($node = db_fetch_object($result)) {
     $nids[] = $node->nid;
   }
@@ -777,8 +793,8 @@ function _taxonomy_access_get_nodes_for_
  * @param $rid
  *    The role id.
  *
- * @return $nid
- *    An array of node ids associated with terms or vocabularies that are 
+ * @return
+ *    An array of node ids associated with terms or vocabularies that are
  *    controlled for the role.
  */
 function _taxonomy_access_get_nodes_for_role($rid) {
@@ -790,7 +806,7 @@ function _taxonomy_access_get_nodes_for_
      LEFT JOIN {term_access} a ON n.tid = a.tid 
      LEFT JOIN {term_access_defaults} ad on ad.vid = d.vid
      WHERE a.rid = %d OR ad.rid = %d', $rid, $rid);
-  
+
   while ($node = db_fetch_object($result)) {
     $nids[] = $node->nid;
   }
@@ -799,6 +815,7 @@ function _taxonomy_access_get_nodes_for_
 
 /**
  * Updates node access grants for a set of nodes.
+ *
  * @param $nids
  *    An array of node ids for which to acquire access permissions.
  */
@@ -812,7 +829,7 @@ function _taxonomy_access_node_access_up
 
     // Remove any duplicate nids from the array.
     $nids = array_unique($nids);
-    
+
     // If the number of nodes is small enough, update node access for each.
     if (sizeof($nids) < TAXONOMY_ACCESS_MAX_UPDATE) {
       foreach ($nids as $node) {
@@ -821,7 +838,7 @@ function _taxonomy_access_node_access_up
           node_access_acquire_grants($loaded_node);
         }
       }
-      
+
       // If we make it here our update was successful; unflag rebuild.
       node_access_needs_rebuild(FALSE);
     }
@@ -831,9 +848,11 @@ function _taxonomy_access_node_access_up
 
 /**
  * Cache and retrieve nodes affected by a taxonomy change.
- * @param $affected_nodes = NULL
+ *
+ * @param $affected_nodes
  *    If we are caching, the list of nids to cache.
- * @return $nodes
+ *
+ * @return
  *    The cached list of nodes.
  */
 function _taxonomy_access_cache_affected_nodes($affected_nodes = NULL) {
@@ -852,20 +871,22 @@ function _taxonomy_access_cache_affected
 
 /**
  * Flag indicating whether we are processing a vocab deletion via admin form.
- * @param $vid = NULL
+ *
+ * @param $vid
  *    The vid being deleted.
- * @return $deleted_vid
+ *
+ * @return
  *    The cached vid, or false if none is cached.
  */
 function _taxonomy_access_del_vocabulary($vid = NULL) {
   static $deleted_vid = FALSE;
 
-  // If we were passed a list of nodes, cache.
+  // If the vid was passed, cache.
   if (isset($vid)) {
     $deleted_vid = $vid;
   }
 
-  // Otherwise, return the cached data.
+  // Otherwise, return the cached value.
   else {
     return $deleted_vid;
   }
@@ -873,20 +894,22 @@ function _taxonomy_access_del_vocabulary
 
 /**
  * Flag indicating whether we are processing a term deletion via admin form.
- * @param $tid = NULL
+ *
+ * @param $tid
  *    The tid being deleted.
- * @return $deleted_vid
+ *
+ * @return
  *    The cached tid, or false if none is cached.
  */
 function _taxonomy_access_del_term($tid = NULL) {
   static $deleted_tid = FALSE;
 
-  // If we were passed a list of nodes, cache.
+  // If the tid was passed, cache.
   if (isset($tid)) {
     $deleted_tid = $tid;
   }
 
-  // Otherwise, return the cached data.
+  // Otherwise, return the cached value.
   else {
     return $deleted_tid;
   }
Only in taxonomy_access_new: taxonomy_access.module~
diff -urp taxonomy_access/taxonomy_access_admin.inc taxonomy_access_new/taxonomy_access_admin.inc
--- taxonomy_access/taxonomy_access_admin.inc	2010-03-14 20:15:18.000000000 -0500
+++ taxonomy_access_new/taxonomy_access_admin.inc	2010-03-14 20:17:23.000000000 -0500
@@ -1,5 +1,5 @@
 <?php
-// $Id: taxonomy_access_admin.inc,v 1.15.2.17 2010/03/14 15:15:54 xjm Exp $
+// $Id: taxonomy_access_admin.inc,v 1.15.2.16 2010/03/13 15:22:03 xjm Exp $
 
 /**
  * @file
@@ -7,7 +7,10 @@
  */
 
 /**
- * Cache roles
+ * Cache a list of all roles.
+ *
+ * @return
+ *    An array of roles from user_roles().
  */
 function _taxonomy_access_user_roles() {
   static $roles;
@@ -18,9 +21,21 @@ function _taxonomy_access_user_roles() {
 }
 
 /**
- * Menu callback; presents the category permissions page of TAC (admin/user/taxonomy_access).
+ * Menu callback (for admin/user/taxonomy_access).
+ * Renders the TAC permissions administration form.
+ *
+ * @param $op
+ *     The operation to perform, if any.
+ *     Options are 'edit' or 'delete' (access rules for the role).
+ * @param $rid
+ *     The role id of the role to configure.
+ * @param $arg
+ *     Additional arguments.  (Not used.)
+ *
+ * @return
+ *     Form to render.
  */
-function taxonomy_access_admin($op = NULL, $rid=NULL, $arg=NULL) {
+function taxonomy_access_admin($op = NULL, $rid = NULL, $arg = NULL) {
   $roles = _taxonomy_access_user_roles();
   if (is_numeric($rid) AND isset($roles[$rid])) {
     switch ($op) {
@@ -33,12 +48,18 @@ function taxonomy_access_admin($op = NUL
   elseif (!isset($op) AND !isset($rid)) {
     return theme_taxonomy_access_admin();
   }
-  //TODO something odd happens here
+  /**
+   * @todo
+   *     Something odd happens here.
+   */
   else return drupal_not_found();
 }
 
 /**
- * Renders the main page of category permissions
+ * Renders the main administration page, with links to configure each role.
+ *
+ * @return
+ *     Themed table with one row for each role.
  */
 function theme_taxonomy_access_admin() {
   $roles = _taxonomy_access_user_roles();
@@ -46,7 +67,7 @@ function theme_taxonomy_access_admin() {
   // Render role/permission overview:
   $header = array(t('Role'), array('data' => '&nbsp;'));
   $rows = array();
-  
+
   $result = db_query('SELECT rid FROM {term_access_defaults} WHERE vid=0 ');
   $active = array();
   while ($role = db_fetch_array($result)) {
@@ -90,7 +111,7 @@ function taxonomy_access_admin_delete_ro
           'SELECT grant_view, grant_update, grant_delete
            FROM {term_access_defaults} 
            WHERE vid=0 AND rid=2'));
- 
+
         if ($role_global_default == $auth_global_default) {
           $affected_nodes = _taxonomy_access_get_nodes_for_role($rid);
         }
@@ -105,18 +126,18 @@ function taxonomy_access_admin_delete_ro
           _taxonomy_access_node_access_update($affected_nodes);
         }
 
-        drupal_set_message(t('All term access rules deleted for role %rid.', 
+        drupal_set_message(t('All term access rules deleted for role %rid.',
             array('%rid' => $rid)));
         drupal_goto('admin/user/taxonomy_access');
       }
 
       else {
         return confirm_form($form,
-          t('Are you sure you want to delete all grant rules for role %rid?', 
+          t('Are you sure you want to delete all grant rules for role %rid?',
             array('%rid' => $rid)),
-          'admin/user/taxonomy_access', 
+          'admin/user/taxonomy_access',
           t('This action cannot be undone.'),
-          t('Delete all'), 
+          t('Delete all'),
           t('Cancel'));
       }
 
@@ -127,37 +148,46 @@ function taxonomy_access_admin_delete_ro
   return drupal_not_found();
 }
 
-// TODO: clarify list VS create grants
+/**
+ * Assembles a row of grant options for a term or default on the admin form.
+ *
+ * @param $grants
+ *     An array of grants to use as form defaults, if any.
+ */
 function taxonomy_access_admin_build_row($grants = NULL) {
   $form['#title'] = '';
   $form['#tree'] = TRUE;
   foreach (array('view', 'update', 'delete') as $grant) {
     $form[$grant] = array(
-      '#type' => 'radios', 
-      '#options' => array('1' => '', '0' => '', '2' => ''), //1: Allow, 0: Ignore, 2: Deny
+      '#type' => 'radios',
+      // 1: Allow, 0: Ignore, 2: Deny
+      '#options' => array('1' => '', '0' => '', '2' => ''),
       '#default_value' => is_string($grants['grant_'. $grant]) ? $grants['grant_'. $grant] : '0',
       '#required' => TRUE,
-     );
+    );
   }
   foreach (array('create', 'list') as $grant) {
     $form[$grant] = array(
-      '#type' => 'checkbox', 
+      '#type' => 'checkbox',
       '#default_value' => is_string($grants['grant_'. $grant]) ? $grants['grant_'. $grant] : '0',
-     );
+    );
   }
   return $form;
 }
 
 /**
  * Form for managing grants by role.
+ *
+ * @param $rid
+ *     The role id.
  */
 function taxonomy_access_admin_form($form_state, $rid = NULL) {
-  // Fetch all default grants
+  // Fetch all default grants.
   $result = db_query('SELECT * FROM {term_access_defaults} WHERE rid = %d', $rid);
   while ($row = db_fetch_array($result)) {
     $default_grants[$row['vid']] = $row;
   }
-  
+
   // If we are adding a role, no global default is set yet, so insert it now.
   if (empty($default_grants[0]) && isset($rid)) {
     // Assemble a $row object for Schema API.
@@ -168,9 +198,8 @@ function taxonomy_access_admin_form($for
     // Insert the row with defaults for all grants.
     drupal_write_record('term_access_defaults', $row);
   }
-  
 
-  // Fetch all grants
+  // Fetch all grants.
   $result = db_query('SELECT * FROM {term_access} WHERE rid = %d', $rid);
   while ($row = db_fetch_array($result)) {
     $grants[$row['tid']] = $row;
@@ -182,8 +211,8 @@ function taxonomy_access_admin_form($for
   );
   $form['rid'] = array('#type' => 'value', '#value' => $rid);
   $form['grants'] = $form['selected_terms'] = $form['selected_defaults'] = array('#tree' => TRUE);
-  
-  //Global default
+
+  // Global default.
   $global_defaults = empty($default_grants[0]) ? NULL : $default_grants[0];
   $form['vocabs'][0]['#title'] = 'Global';
   $form['grants'][0][0] = taxonomy_access_admin_build_row($global_defaults);
@@ -222,7 +251,7 @@ function taxonomy_access_admin_form($for
       }
     }
   }
-  //New grant row
+  // New grant row.
   if (isset($add_items)) {
     $form['new']['grants'] = taxonomy_access_admin_build_row();
     $form['new']['#tree'] = TRUE;
@@ -240,7 +269,7 @@ function taxonomy_access_admin_form($for
       '#value' => t('Add'),
     );
   }
-  
+
   $form['delete'] = array(
     '#type' => 'submit',
     '#value' => t('Delete selected'),
@@ -255,7 +284,10 @@ function taxonomy_access_admin_form($for
 }
 
 /**
- * Renders the permission matrix user form for choosen user role.
+ * Renders the permission matrix user form for a given user role.
+ *
+ * @return
+ *     String containing rendered HTML form in table.
  */
 function theme_taxonomy_access_admin_form($form) {
   $roles = _taxonomy_access_user_roles();
@@ -305,7 +337,7 @@ function theme_taxonomy_access_admin_for
           foreach (array('create', 'list') as $grant) {
             $row[] = array('data' => drupal_render($form['grants'][$vid][$tid][$grant]));
           }
-          $rows[] = $row; 
+          $rows[] = $row;
         }
       }
     }
@@ -318,7 +350,7 @@ function theme_taxonomy_access_admin_for
     $row = array(
       array(
         'data' => drupal_render($form['new']['item'])
-        . drupal_render($form['new']['recursive']), 
+        . drupal_render($form['new']['recursive']),
         'colspan' => '2',
       ),
       drupal_render($form['new']['add']),
@@ -333,7 +365,7 @@ function theme_taxonomy_access_admin_for
     foreach (array('create', 'list') as $grant) {
       $row[] = array('data' => drupal_render($form['new']['grants'][$grant]));
     }
-    $rows[] = $row; 
+    $rows[] = $row;
     $row = array();
   }
 
@@ -345,9 +377,12 @@ function theme_taxonomy_access_admin_for
   return $output;
 }
 
+/**
+ * Submit handler for the administration form at admin/user/taxonomy_access.
+ */
 function taxonomy_access_admin_form_submit($form, &$form_state) {
   $values = $form_state['values'];
-  
+
   switch ($values['op']) {
 
     case t('Delete selected'):
@@ -356,7 +391,7 @@ function taxonomy_access_admin_form_subm
           if ($enabled) {
             $affected_nodes = _taxonomy_access_get_nodes_for_term($tid);
             db_query(
-              'DELETE FROM {term_access} WHERE rid = %d AND tid = %d', 
+              'DELETE FROM {term_access} WHERE rid = %d AND tid = %d',
               $values['rid'], $tid
             );
             _taxonomy_access_cache_affected_nodes($affected_nodes);
@@ -366,11 +401,11 @@ function taxonomy_access_admin_form_subm
       if (is_array($values['selected_defaults'])) {
         foreach ($values['selected_defaults'] as $vid => $enabled) {
           if ($enabled) {
-            $affected_nodes = 
+            $affected_nodes =
               _taxonomy_access_get_nodes_for_vocabulary($vid, $values['rid']);
             db_query(
               "DELETE FROM {term_access_defaults} WHERE rid = %d AND vid = %d",
-              $values['rid'], 
+              $values['rid'],
               $vid
             );
             _taxonomy_access_cache_affected_nodes($affected_nodes);
@@ -392,7 +427,7 @@ function taxonomy_access_admin_form_subm
       if ($type == 'term') {
         if ($new['recursive'] == 1) {
           taxonomy_access_recursive_grant_update($id, $values['rid'], $new['grants']);
-        } 
+        }
         else {
           taxonomy_access_grant_update($id, $values['rid'], $new['grants']);
         }
@@ -416,7 +451,7 @@ function taxonomy_access_admin_form_subm
           // Check the default values for this row.
           $defaults = array();
           foreach ($grants as $grant_name => $value) {
-            $defaults[$grant_name] = 
+            $defaults[$grant_name] =
               $form['grants'][$vid][$tid][$grant_name]['#default_value'];
           }
 
@@ -465,14 +500,14 @@ function taxonomy_access_admin_form_subm
  * @param $grants
  *   A hash of the grants in the form of $grants['perm'] = boolean
  *   A value of 1 will grant the permission for this user and term.
- * @param $skip_nodes = FALSE
+ * @param $skip_nodes
  *   A flag indicating whether to skip node updates when processing.
-**/
+ */
 function taxonomy_access_grant_update($tid, $rid = NULL, $grants = NULL, $skip_nodes = FALSE) {
   if (!isset($tid) OR !is_numeric($rid)) {
     return FALSE;
   }
-  
+
   // Assemble a $row object for Schema API.
   $row = new stdClass();
   $row->tid = $tid;
@@ -487,7 +522,7 @@ function taxonomy_access_grant_update($t
       }
     }
   }
-  
+
   if (!$skip_nodes) {
     $affected_nodes = _taxonomy_access_get_nodes_for_term($tid);
   }
@@ -505,25 +540,32 @@ function taxonomy_access_grant_update($t
 }
 
 /**
- * Recursively updates permissions for a role for a term
+ * Recursively updates permissions for a role for a term.
+ *
+ * @param $tid
+ *   The term to add the permission for.
+ * @param $rid
+ *   The role id to add the permission for.
+ * @param $grants
+ *   A hash of the grants in the form of $grants['perm'] = boolean
+ *   A value of 1 will grant the permission for this user and term.
  */
 function taxonomy_access_recursive_grant_update($tid, $rid = NULL, $grants = NULL) {
   // First, process the original.
   taxonomy_access_grant_update($tid, $rid, $grants);
-  
+
   // Process the children.
   $ran_tids = array(); // tids that have been processed.
   $run_tids = array($tid); // tids that are in the queue to be processed.
-  while (count($run_tids) > 0) { 
+  while (count($run_tids) > 0) {
     foreach ($run_tids as $run_key => $run_tid) {
       // Some basic loop protection.
       if (!(array_search($run_tid, $ran_tids) === FALSE)) {
         drupal_set_message(
           t("Loop detected for tid %run_tid. Stopping.",
-            array('%run_tid' => $run_tid)
-           ));
+            array('%run_tid' => $run_tid)));
         $run_tids = array(); // stop the execution
-      } 
+      }
       else {
         $result = db_query('SELECT th.tid FROM {term_hierarchy} th WHERE th.parent = %d', $run_tid);
         // If this tid has children, update grants and queue the children
@@ -553,9 +595,9 @@ function taxonomy_access_recursive_grant
  * @param $grants
  *   A hash of the grants in the form of $grants['perm'] = boolean
  *   A value of 1 will grant the permission for this user and term.
- * @param $skip_nodes = FALSE
+ * @param $skip_nodes
  *   A flag indicating whether to skip node updates when processing.
-**/
+ */
 function taxonomy_access_defaults_update($vid, $rid = NULL, $grants = NULL, $skip_nodes = FALSE) {
   if (!is_numeric($vid) || (isset($rid) && !is_numeric($rid))) {
     return FALSE;
@@ -585,10 +627,10 @@ function taxonomy_access_defaults_update
       $affected_nodes = _taxonomy_access_get_nodes_for_vocabulary($vid, $rid);
     }
   }
-  
+
   // Delete old entries.
   db_query("DELETE FROM {term_access_defaults} WHERE vid = %d AND rid = %d", $vid, $rid);
-  
+
   // Insert new entries.
   drupal_write_record('term_access_defaults', $row);
 
@@ -598,6 +640,12 @@ function taxonomy_access_defaults_update
   }
 }
 
+/**
+ * Generates HTML markup with form instructions for the admin form.
+ *
+ * @return
+ *     Instructions HTML string.
+ */
 function _taxonomy_access_admin_instructions_html() {
   $instructions = '';
   $instructions .= ''
@@ -609,24 +657,22 @@ function _taxonomy_access_admin_instruct
     . t('Options for View, Update, and Delete are <em>Allow</em> (<acronym title="Allow">A</acronym>), <em>Ignore</em> (<acronym title="Ignore">I</acronym>), and <em>Deny</em> (<acronym title="Deny">D</acronym>).')
     . "</p>\n\n"
     . "<ul>\n"
-    . "<li>" 
-    . t('<em>Deny</em> (<acronym title="Deny">D</acronym>) overrides <em>Allow</em> (<acronym title="Allow">A</acronym>) within this role.') 
+    . "<li>"
+    . t('<em>Deny</em> (<acronym title="Deny">D</acronym>) overrides <em>Allow</em> (<acronym title="Allow">A</acronym>) within this role.')
     . "</li>"
-    . "<li>" 
-    . t('Both <em>Allow</em> (<acronym title="Allow">A</acronym>) and <em>Deny</em> (<acronym title="Deny">D</acronym>) override <em>Ignore</em> (<acronym title="Ignore">I</acronym>) within this role.') 
+    . "<li>"
+    . t('Both <em>Allow</em> (<acronym title="Allow">A</acronym>) and <em>Deny</em> (<acronym title="Deny">D</acronym>) override <em>Ignore</em> (<acronym title="Ignore">I</acronym>) within this role.')
     . "</li>"
-    . "<li>" 
-    . t('If a user has <strong>multiple roles</strong>, an <em>Allow</em> (<acronym title="Allow">A</acronym>) from another role <strong>will</strong> override a <em>Deny</em> (<acronym title="Deny">D</acronym>) here.') 
+    . "<li>"
+    . t('If a user has <strong>multiple roles</strong>, an <em>Allow</em> (<acronym title="Allow">A</acronym>) from another role <strong>will</strong> override a <em>Deny</em> (<acronym title="Deny">D</acronym>) here.')
     . "</li>"
     . "</ul>\n\n"
     ;
   if (arg(4) > 2) { // Role other than Anonymous or Authenticated
     $instructions .= ''
       . "<p>"
-      . t('<strong>Remember:</strong> This role <strong>will</strong> inherit permissions from the <em>authenticated user</em> role.  Be sure to <a href="@url">configure
-the authenticated user</a> properly.',
-        array("@url" => url("admin/user/taxonomy_access/edit/2"))
-         )
+      . t('<strong>Remember:</strong> This role <strong>will</strong> inherit permissions from the <em>authenticated user</em> role.  Be sure to <a href="@url">configure the authenticated user</a> properly.',
+        array("@url" => url("admin/user/taxonomy_access/edit/2")))
       . "</p>\n\n"
       ;
   }
@@ -645,9 +691,14 @@ the authenticated user</a> properly.',
 
 }
 
-
+/**
+ * Assemble a table explaining each grant type for use in help documentation.
+ *
+ * @return
+ *     Themed table.
+ */
 function _taxonomy_access_grant_help_table() {
- $header = array();
+  $header = array();
 
   $rows = array();
   $rows[] = array(
@@ -657,10 +708,7 @@ function _taxonomy_access_grant_help_tab
     . "</p>"
     . "<p>"
     . t('The role must <strong>have</strong> <em class="perm">access content</em> permission on the <a href="@path">permissions administration form</a>.',
-      array(
-        '@path' => url('admin/user/permissions',
-                 array('fragment' => 'module-node')),
-      )),
+      array('@path' => url('admin/user/permissions', array('fragment' => 'module-node')))),
   );
 
   $rows[] = array(
@@ -670,10 +718,7 @@ function _taxonomy_access_grant_help_tab
     . "</p>"
     . "<p>"
     . t('The role must <strong>not</strong> have <em class="perm">edit any [type] content</em> or <em class="perm">delete any [type] content</em> permission on the <a href="@path">permissions administration form</a> if you wish to control them here.',
-      array(
-        '@path' => url('admin/user/permissions',
-                 array('fragment' => 'module-node')),
-      ))
+      array('@path' => url('admin/user/permissions', array('fragment' => 'module-node'))))
     ."</p>",
   );
 
@@ -684,16 +729,13 @@ function _taxonomy_access_grant_help_tab
     . "</p>"
     . "<p>"
     . t('This does <strong>not</strong> give the role the ability to create nodes by itself; the role must <strong>have</strong> <em class="perm">create [type] content</em> permission on the <a href="@path">permissions administration form</a> in order to create new nodes.',
-      array(
-        '@path' => url('admin/user/permissions',
-                 array('fragment' => 'module-node')),
-      ))
+      array('@path' => url('admin/user/permissions', array('fragment' => 'module-node'))))
     ."</p>",
   );
 
   $rows[] = array(
     array('header' => TRUE, 'data' => t("List")),
-    "<p>" 
+    "<p>"
     . t("Whether this role can see the term listed on node pages and in lists, and whether the user can view the %taxonomy-term-page page for the term.",
       array(
         '%taxonomy-term-page' => "taxonomy/term/x"
