diff --git a/permission_select.js b/permission_select.js
index b8471de..0f45a13 100644
--- a/permission_select.js
+++ b/permission_select.js
@@ -1,65 +1,66 @@
 var $ = jQuery.noConflict();
 
 function safelog(data) {if(console){console.log(data)}}
-/** 
+/**
  * @param link
- * @return the jQuery selector to use in finding the checkboxes we are attempting to manipulate
+ * @return an array of matched elements (jQuery object) of the checkbox inputs we are attempting to manipulate
  */
 function find_matching_checkboxes(link) {
-	var module = $(link)
-								.parent('td')
-								.parent('tr')
-								.children('td.module_name')
-								.attr('id');
-	safelog('module name to modify: '+module);
-	var ctd = $(link).parent('td');
-	// get the index of the current column
-	var col_index = $('tr.'+module+' td').index(ctd);
-	col_index++;
-	return 'tr.'+module+' td:nth-child('+col_index+') input:checkbox';
+  var module = $(link)
+                .parent('td')
+                .parent('tr')
+                .children('td.module')
+                .attr('id');
+  safelog('module name to modify: '+module);
+  var ctd = $(link).parent('td');
+  // get the index of the current column
+  var col_index = $('tr.'+module+' td').index(ctd);
+  col_index++;
+  // module's perms are sibling <tr> elements until next tr.module_parent
+  return $('tr.'+module).nextUntil('tr.module_parent').find('td:nth-child('+col_index+') input:checkbox');
 }
 
 $(document).ready(function(){
 
-  // get number of columns we will need to manipulate & add 
+  // get number of columns we will need to manipulate & add
   // select / unselect options for each module header row
   var roles = $('#permissions > thead > tr > th.checkbox');
   var role_count = roles.size();
-  
-  // take off the stupid colspan from the module header row, because we 
+
+  // take off the stupid colspan from the module header row, because we
   // will be matching up to the other rows perfectly now
   $('td.module').removeAttr('colspan');
-  
-  // needed to add in a defining class or id to the parent TR in 
+
+  // needed to add in a defining class or id to the parent TR in
   // order to have a reference to grab a proper index for the links
   // being clicked.
   $('td.module').each(function(){
     var module_id = $(this).attr('id');
     $(this)
-    	.parent('tr')
-    	.addClass(module_id+' module_parent')
-    	.attr('rel', module_id);
+      .parent('tr')
+      .addClass(module_id+' module_parent')
+      .attr('rel', module_id);
   });
-  
-  // cycle how many roles we have and insert that many columns worth of 
+
+  // cycle how many roles we have and insert that many columns worth of
   // select / deselect options
   $(roles).each(function(){
-	  $('td.module')
-	   		.after('<td class="pselect"><a href="#" class="check">check all</a>&nbsp;/&nbsp;<a href="#" class="uncheck">uncheck all</a></td>');
-	  });
+    $('td.module')
+         .after('<td class="pselect"><a href="#" class="check">check all</a>&nbsp;/&nbsp;<a href="#" class="uncheck">uncheck all</a></td>');
+    });
 
   // give the new boxes the module class to preserve styling of the row
   $('td.pselect').addClass('module');
 
-  // clicky 
+  // clicky
   $('a.check').click(function(){
-	var check_it = find_matching_checkboxes(this);
-	$(check_it).attr('checked', true);
-	return false;	
+  var check_it = find_matching_checkboxes(this);
+  $(check_it).attr('checked', true);
+  return false;
   });
   $('a.uncheck').click(function(){
-	var uncheck_it = find_matching_checkboxes(this);
-	$(uncheck_it).attr('checked', false);
-	return false;	
-  });  
+  var uncheck_it = find_matching_checkboxes(this);
+  $(uncheck_it).attr('checked', false);
+  return false;
+  });
 });
diff --git a/permission_select.module b/permission_select.module
index b50be16..06918b0 100644
--- a/permission_select.module
+++ b/permission_select.module
@@ -1,7 +1,7 @@
 <?php
 /**
  * @file
- * Module will add select all/deselect all options through out the 
+ * Module will add select all/deselect all options through out the
  * admin permission selection screen
  */
 
@@ -20,8 +20,7 @@ function permission_select_permission() {
  * Implementation of hook_init().
  */
 function permission_select_init() {
-  if (user_access('use permission select') && 
-substr($_GET['q'], 0, 24) == 'admin/people/permissions') {
+  if (user_access('use permission select') && substr($_GET['q'], 0, 24) == 'admin/people/permissions') {
     $path = drupal_get_path('module', 'permission_select');
     drupal_add_css($path .'/permission_select.css', array('type' => 'module', 'media' => 'all', 'preprocess' => TRUE,));
     drupal_add_js($path .'/permission_select.js');
@@ -32,14 +31,15 @@ substr($_GET['q'], 0, 24) == 'admin/people/permissions') {
  * telling the system we want to use out custom function to render this form
  */
 function permission_select_theme_registry_alter(&$theme_registry) {
-  if (!empty($theme_registry['user_admin_perm'])) {
-    $theme_registry['user_admin_perm']['function'] = 'permission_select_theme_user_admin_perm';
+  if (!empty($theme_registry['user_admin_permissions'])) {
+    $theme_registry['user_admin_permissions']['function'] = 'permission_select_theme_user_admin_perm';
   }
 }
 /**
  * Theme the administer permissions page.
  */
-function permission_select_theme_user_admin_perm($form) {
+function permission_select_theme_user_admin_perm($variables) {
+  $form = $variables['form'];
   $roles = user_roles();
   foreach (element_children($form['permission']) as $key) {
     // Don't take form control structures
@@ -47,35 +47,33 @@ function permission_select_theme_user_admin_perm($form) {
       $row = array();
       // Module name
       if (is_numeric($key)) {
-        $mod_name = t($form['permission'][$key]['#id']);
-        $row[] = array('data' => t('@module module', array('@module' => drupal_render($form['permission'][$key]))), 'class' => 'module module_name', 'id' => 'module-'. $mod_name, 'colspan' => count($form['role_names']) + 1);
+        $row[] = array('data' => drupal_render($form['permission'][$key]), 'class' => array('module'), 'id' => 'module-' . $form['permission'][$key]['#id'], 'colspan' => count($form['role_names']['#value']) + 1);
       }
       else {
         // Permission row.
         $row[] = array(
           'data' => drupal_render($form['permission'][$key]),
-          'class' => 'permission',
+          'class' => array('permission'),
         );
         foreach (element_children($form['checkboxes']) as $rid) {
           if (is_array($form['checkboxes'][$rid])) {
-            $row[] = array('data' => drupal_render($form['checkboxes'][$rid][$key]), 'class' => 'checkbox module-'. $mod_name, 'title' => $roles[$rid] . ' : ' . t($key));
+            $form['checkboxes'][$rid][$key]['#title'] = $roles[$rid] . ': ' . $form['permission'][$key]['#markup'];
+            $form['checkboxes'][$rid][$key]['#title_display'] = 'invisible';
+            $row[] = array('data' => drupal_render($form['checkboxes'][$rid][$key]), 'class' => array('checkbox'));
           }
         }
       }
-      $rows[] = array(
-        'data' => $row,
-        'class' => 'module-'. $mod_name,
-      );
+      $rows[] = $row;
     }
   }
   $header[] = (t('Permission'));
   foreach (element_children($form['role_names']) as $rid) {
     if (is_array($form['role_names'][$rid])) {
-      $header[] = array('data' => drupal_render($form['role_names'][$rid]), 'class' => 'checkbox');
+      $header[] = array('data' => drupal_render($form['role_names'][$rid]), 'class' => array('checkbox'));
     }
   }
   $output = theme('system_compact_link');
-  $output .= theme('table', $header, $rows, array('id' => 'permissions'));
+  $output .= theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'permissions')));
   $output .= drupal_render_children($form);
   return $output;
 }
