diff --git a/modules/taxonomy/views_handler_filter_term_node_tid.inc b/modules/taxonomy/views_handler_filter_term_node_tid.inc
index 7eb868f..19833cb 100644
--- a/modules/taxonomy/views_handler_filter_term_node_tid.inc
+++ b/modules/taxonomy/views_handler_filter_term_node_tid.inc
@@ -41,6 +41,7 @@ class views_handler_filter_term_node_tid extends views_handler_filter_many_to_on
     $options['limit'] = array('default' => TRUE, 'bool' => TRUE);
     $options['vocabulary'] = array('default' => 0);
     $options['hierarchy'] = array('default' => 0);
+    $options['groups'] = array('default' => 0);
     $options['error_message'] = array('default' => TRUE, 'bool' => TRUE);
 
     return $options;
@@ -84,6 +85,12 @@ class views_handler_filter_term_node_tid extends views_handler_filter_many_to_on
       '#default_value' => !empty($this->options['hierarchy']),
       '#dependency' => array('radio:options[type]' => array('select')),
     );
+    $form['groups'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Show groups in dropdown'),
+      '#default_value' => !empty($this->options['groups']),
+      '#dependency' => array('radio:options[type]' => array('select')),
+    );
   }
 
   function value_form(&$form, &$form_state) {
@@ -122,14 +129,22 @@ class views_handler_filter_term_node_tid extends views_handler_filter_many_to_on
     }
     else {
       if (!empty($this->options['hierarchy']) && $this->options['limit']) {
-        $tree = taxonomy_get_tree($vocabulary->vid);
         $options = array();
-
-        if ($tree) {
-          foreach ($tree as $term) {
-            $choice = new stdClass();
-            $choice->option = array($term->tid => str_repeat('-', $term->depth) . $term->name);
-            $options[] = $choice;
+        if ($tree = taxonomy_get_tree($vocabulary->vid)) {
+          if ($this->options['groups']) {
+            foreach ($tree as $term) {
+              if ($term->parents[0] == 0) {
+                $parent_name = $term->name;
+              }
+              else {
+                $options[$parent_name][$term->tid] = str_repeat('-', $term->depth) . $term->name;
+              }
+            }
+          }
+          else {
+            foreach ($tree as $term) {
+              $options[$term->tid] = str_repeat('-', $term->depth) . $term->name;
+            }
           }
         }
       }
