diff --git a/term_reference_tree.css b/term_reference_tree.css
index 40ba2cf..9431744 100644
--- a/term_reference_tree.css
+++ b/term_reference_tree.css
@@ -2,7 +2,7 @@
 .block .field-widget-term-reference-tree ul,
 .field-widget-term-reference-tree ul
 {
-  list-style-type: none; 
+  list-style-type: none;
   margin-top: 0;
   margin-bottom: 0;
   margin-left: 0;
diff --git a/term_reference_tree.field.inc b/term_reference_tree.field.inc
index 212c737..04c1830 100644
--- a/term_reference_tree.field.inc
+++ b/term_reference_tree.field.inc
@@ -66,7 +66,7 @@ function term_reference_tree_field_formatter_settings_form($field, $instance, $v
       '#token_types' => array('term'),
     );
   }
-  
+
   return $element;
 }
 
diff --git a/term_reference_tree.js b/term_reference_tree.js
index d2204a2..4dd59ec 100644
--- a/term_reference_tree.js
+++ b/term_reference_tree.js
@@ -25,7 +25,7 @@
         });
 
         // On page load, check if the start minimized option is selected.  If so,
-        // minimize each tree, except for lists that contain a checked box.   
+        // minimize each tree, except for lists that contain a checked box.
         if($(this).hasClass('term-reference-tree-start-minimized')) {
           $(this).find('.term-reference-tree-button').each(function() {
             // If no sibling <ul>'s contain a checked checkbox, add the
@@ -37,23 +37,23 @@
             }
           });
         }
-        
-        //On page load, check if the user wants a track list. If so, add the 
+
+        //On page load, check if the user wants a track list. If so, add the
         //currently selected items to it.
         if($(this).hasClass('term-reference-tree-track-list-shown')) {
           var track_list_container = $(this).find('.term-reference-tree-track-list');
-          
+
           //Var to track whether using checkboxes or radio buttons.
           var input_type =
             ( $(this).has('input[type=checkbox]').size() > 0 ) ? 'checkbox' : 'radio';
-            
+
           //Find all the checked controls.
           var checked_controls = $(this).find('input[type=' + input_type + ']:checked');
 
           //Get their labels.
           var labels = checked_controls.next();
           var label_element;
-          
+
           //For each label of the checked boxes, add item to the track list.
           labels.each(function(index) {
             label_element = $(labels[index]);
@@ -64,10 +64,10 @@
               input_type                    //checkbox or radio
             );
           }); //End labels.each
-          
+
           //Show "nothing selected" message, if needed.
           showNothingSelectedMessage(track_list_container);
-          
+
           //Event - when an element on the track list is clicked on:
           //  1. Delete it.
           //  2. Uncheck the associated checkbox.
@@ -89,7 +89,7 @@
               showNothingSelectedMessage(track_list_container);
             }
           });
-          
+
           //Change track list when controls are clicked.
           $(this).find('.form-' + input_type).click(function(event){
             //Remove the "nothing selected" message if showing - add it later if needed.
@@ -110,41 +110,41 @@
               //Checkbox unchecked. Remove from the track list.
               $('#' + control_id + '_list').remove();
             }
-            
+
             //Show "nothing selected" message, if needed.
             showNothingSelectedMessage(track_list_container);
           }); //End process checkbox changes.
         } //End Want a track list.
-        
+
       });
     }
   };
-  
+
   /**
-   * Add a new item to the track list. 
-   * If more than one item can be selected, the new item is positioned to 
+   * Add a new item to the track list.
+   * If more than one item can be selected, the new item is positioned to
    * match the order of the terms in the checkbox tree.
-   * 
+   *
    * @param track_list_container Container where the new item will be added.
-   * 
+   *
    * @param item_text Text of the item to add.
-   * 
+   *
    * @param control_id Id of the checkbox/radio control the item matches.
-   * 
+   *
    * @param control_type Control type - 'checkbox' or 'radio'.
    */
   function addItemToTrackList(track_list_container, item_text, control_id, control_type) {
     var new_item = $('<li class="track-item">' + item_text + '</li>');
     new_item.data('control_id', control_id);
-    
+
     //Add an id for easy finding of the item.
     new_item.attr('id', control_id + '_list');
-    
+
     //Process radio controls - only one item can be selected.
     if ( control_type == 'radio') {
       //Find the existing element on the track list, if there is one.
       var current_items = track_list_container.find('li');
-      
+
       //If there are no items on the track list, add the new item.
       if ( current_items.size() == 0 ) {
         track_list_container.append(new_item);
@@ -152,7 +152,7 @@
       else {
         //There is an item on the list.
         var current_item = $(current_items.get(0));
-        
+
         //Is the item we want to add different from what is there?
         if ( current_item.data('control_id') != control_id ) {
           //Remove exiting element from track list, and add the new one.
@@ -162,18 +162,18 @@
       }
       return;
     }
-    
+
     //Using checkboxes, so there can be more than one selected item.
     //Find the right place to put the new item, to match the order of the
     //checkboxes.
     var list_items = track_list_container.find('li');
     var item_comparing_to;
-    
+
     //Flag to tell whether the item was inserted.
     var inserted_flag = false;
     list_items.each(function(index){
       item_comparing_to = $(list_items[index]);
-      
+
       //If item is already on the track list, do nothing.
       if ( control_id == item_comparing_to.data('control_id') ) {
         inserted_flag = true;
@@ -186,26 +186,26 @@
         return false; //Returning false stops the loop.
       }
     });
-    
+
     //If not inserted yet, add new item at the end of the track list.
     if ( ! inserted_flag ) {
       track_list_container.append(new_item);
     }
   }
-  
+
   /**
    * Show the 'nothing selected' message if it applies.
-   * 
+   *
    * @param track_list_container Where the message is to be shown.
    */
   function showNothingSelectedMessage(track_list_container) {
     //Is the message there already?
-    var message_showing = 
+    var message_showing =
         (track_list_container.find('.term_ref_tree_nothing_message').size() != 0);
-        
+
     //Number of real items showing.
-    var num_real_items_showing = 
-        message_showing 
+    var num_real_items_showing =
+        message_showing
         ? track_list_container.find('li').size() - 1
         : track_list_container.find('li').size();
     if ( num_real_items_showing == 0 ) {
@@ -226,7 +226,7 @@
 
   /**
    * Remove the 'nothing selected' message. Makes processing easier.
-   * 
+   *
    * @param track_list_container Where the message is shown.
    */
   function removeNothingSelectedMessage(track_list_container) {
@@ -242,7 +242,7 @@
     }
     catch (e){}
     var count = item.find(':checked').length;
-    
+
     if(maxChoices > 0 && count >= maxChoices) {
       item.find('input[type=checkbox]:not(:checked)').attr('disabled', 'disabled').parent().addClass('disabled');
     } else {
@@ -254,11 +254,11 @@
         var track_list_container = item.find('.term-reference-tree-track-list');
         var input_type =
             ( item.has('input[type=checkbox]').size() > 0 ) ? 'checkbox' : 'radio';
-            
+
         if(checkbox.attr('checked')) {
           checkbox.parents('ul.term-reference-tree-level li').children('div.form-item').children('input[type=checkbox]').each(function() {
             $(this).attr('checked', checkbox.attr('checked'));
-            
+
             if(track_list_container) {
               label_element = $(this).next();
               addItemToTrackList(
@@ -273,4 +273,4 @@
       }
     }
   }
-})(jQuery);
\ No newline at end of file
+})(jQuery);
diff --git a/term_reference_tree.module b/term_reference_tree.module
index f63108b..94cdeab 100644
--- a/term_reference_tree.module
+++ b/term_reference_tree.module
@@ -35,7 +35,7 @@ function term_reference_tree_element_info() {
       '#pre_render' => array('form_pre_render_conditional_form_element'),
     ),
   );
-  
+
   return $types;
 }
 
@@ -75,11 +75,11 @@ function term_reference_tree_theme() {
  *   The vocabulary ID to restrict the child search.
  *
  * @return
- *   A nested array of the term's child objects.  
+ *   A nested array of the term's child objects.
  */
 function _term_reference_tree_get_term_hierarchy($tid, $vid, &$allowed, $filter, $label) {
   $terms = _term_reference_tree_get_children($tid, $vid);
-  
+
   $result = array();
 
   if ($filter != '') {
@@ -92,7 +92,7 @@ function _term_reference_tree_get_term_hierarchy($tid, $vid, &$allowed, $filter,
         }
         $term->TEST = $label;
         array_push($result, $term);
-      }      
+      }
     }
   }
   else {
@@ -107,7 +107,7 @@ function _term_reference_tree_get_term_hierarchy($tid, $vid, &$allowed, $filter,
       }
     }
   }
-  
+
   return $result;
 }
 
@@ -170,9 +170,9 @@ function _term_reference_tree_flatten($element, &$form_state) {
 
 /**
  * Return an array of options.
- * 
+ *
  * This function converts a list of taxonomy terms to a key/value list of options.
- * 
+ *
  * @param $terms
  *   An array of taxonomy term IDs.
  * @param $allowed
@@ -180,7 +180,7 @@ function _term_reference_tree_flatten($element, &$form_state) {
  * @param $filter
  *   A string defining the view to filter by (only used to detect whether view
  *   filtering is enabled
- * 
+ *
  * @return
  *   A key/value array of taxonomy terms (name => id)
  */
diff --git a/term_reference_tree.widget.inc b/term_reference_tree.widget.inc
index 2e2b483..0a4bd36 100644
--- a/term_reference_tree.widget.inc
+++ b/term_reference_tree.widget.inc
@@ -9,7 +9,7 @@ function term_reference_tree_field_widget_info() {
       'label' => 'Term reference tree',
       'field types' => array('taxonomy_term_reference'),
       'behaviors' => array(
-        'multiple values' => FIELD_BEHAVIOR_CUSTOM, 
+        'multiple values' => FIELD_BEHAVIOR_CUSTOM,
         'default value' => FIELD_BEHAVIOR_DEFAULT,
       ),
       'settings' => array(
@@ -42,11 +42,11 @@ function theme_term_tree_list($variables) {
     while($tid != 0) {
       # Unshift the term onto an array
       array_unshift($values, $tid);
-      
+
       # Repeat with parent term
       $tid = _term_reference_tree_get_parent($tid);
     }
-    
+
     $current =& $tree;
     # For each term in the above array:
     foreach($values as $tid) {
@@ -54,7 +54,7 @@ function theme_term_tree_list($variables) {
       if (!isset($current['children'][$tid])) {
         $current['children'][$tid] = array('selected' => FALSE);
       }
-      
+
       # If this is the last value in the array, tree[children][term_id][selected] = true
       if ($tid == $original_tid) {
         $current['children'][$tid]['selected'] = TRUE;
@@ -64,7 +64,7 @@ function theme_term_tree_list($variables) {
       $current =& $current['children'][$tid];
     }
   }
-  
+
   return _term_reference_tree_output_list_level($element, $tree);
 }
 
@@ -76,7 +76,7 @@ function term_reference_tree_field_widget_settings_form($field, $instance) {
   $widget = $instance['widget'];
   $settings = $widget['settings'];
   $form = array();
-  
+
   if ($widget['type'] == 'term_reference_tree') {
     $form['start_minimized'] = array(
       '#type' => 'checkbox',
@@ -85,7 +85,7 @@ function term_reference_tree_field_widget_settings_form($field, $instance) {
       '#default_value' => $settings['start_minimized'],
       '#return_value' => 1,
     );
-    
+
     $form['leaves_only'] = array(
       '#type' => 'checkbox',
       '#title' => t('Leaves only'),
@@ -106,7 +106,7 @@ function term_reference_tree_field_widget_settings_form($field, $instance) {
     if (module_exists('views')) {
       $views = views_get_all_views();
       $options = array('' => 'none');
-      
+
       foreach($views as $name => $view) {
         if ($view->base_table == 'taxonomy_term_data') {
           foreach($view->display as $display) {
@@ -150,7 +150,7 @@ function term_reference_tree_field_widget_settings_form($field, $instance) {
       );
     }
 
-    
+
     $form['track_list'] = array(
       '#type' => 'checkbox',
       '#title' => t('Track list'),
@@ -213,14 +213,14 @@ function _term_reference_tree_select_parents_validate($element, &$form_state) {
 
 /**
  * Process the checkbox_tree widget.
- * 
+ *
  * This function processes the checkbox_tree widget.
- * 
+ *
  * @param $element
  *   The element to be drawn.$element['#field_name']
  * @param $form_state
  *   The form state.
- * 
+ *
  * @return
  *   The processed element.
  */
@@ -229,7 +229,7 @@ function term_reference_tree_process_checkbox_tree($element, $form_state) {
     if (!empty($element['#max_choices']) && $element['#max_choices'] != '-1')
       drupal_add_js(array('term_reference_tree' => array('trees' => array($element['#id'] => array('max_choices'=>$element['#max_choices'])))), 'setting');
     $allowed = '';
-    
+
     if ($element['#filter_view'] != '') {
       $allowed = _term_reference_tree_get_allowed_values($element['#filter_view']);
     }
@@ -271,7 +271,7 @@ function term_reference_tree_process_checkbox_tree($element, $form_state) {
         '#max_choices' => $max_choices,
       );
     }
-  } 
+  }
 
   return $element;
 }
@@ -288,17 +288,17 @@ function term_reference_tree_process_checkbox_tree($element, $form_state) {
 function theme_checkbox_tree($variables) {
   $element = $variables['element'];
   $element['#children'] = drupal_render_children($element);
-  
+
   $attributes = array();
   if (isset($element['#id'])) {
     $attributes['id'] = $element['#id'];
   }
   $attributes['class'][] = 'term-reference-tree';
-  
+
   if (form_get_error($element)) {
     $attributes['class'][] = 'error';
   }
-  
+
   if (!empty($element['#required'])) {
     $attributes['class'][] = 'required';
   }
@@ -316,9 +316,9 @@ function theme_checkbox_tree($variables) {
   if (!empty($element['#attributes']['class'])) {
     $attributes['class'] = array_merge($attributes['class'], $element['#attributes']['class']);
   }
-  return 
-      '<div' . drupal_attributes($attributes) . '>' 
-    . (!empty($element['#children']) ? $element['#children'] : '') 
+  return
+      '<div' . drupal_attributes($attributes) . '>'
+    . (!empty($element['#children']) ? $element['#children'] : '')
     . '</div>';
 }
 
@@ -360,7 +360,7 @@ function theme_checkbox_tree_item($variables) {
   $element = $variables['element'];
   $children = element_children($element);
   $output = "";
-  
+
   if (is_array($children) && count($children) > 1) {
     $output .= "<div class='term-reference-tree-button'></div>";
 
@@ -372,7 +372,7 @@ function theme_checkbox_tree_item($variables) {
   foreach($children as $child) {
     $output .= drupal_render($element[$child]);
   }
-  
+
   return $output;
 }
 
@@ -390,23 +390,23 @@ function theme_checkbox_tree_label($variables) {
  * The display happens on the client-side.
  * Use this function to theme the element's label,
  * and the "nothing selected" message.
- * 
- * @param $variables Variables available for theming. 
+ *
+ * @param $variables Variables available for theming.
  */
 function theme_checkbox_tree_track_list($variables) {
   //Should the label be singular or plural? Depends on cardinality of term field.
   $nothingselected = t('[Nothing selected]');
   $label = format_plural(
-      $variables['element']['#max_choices'], 
+      $variables['element']['#max_choices'],
       'Selected item (click the item to uncheck it)',
       'Selected items (click an item to uncheck it)'
   );
-  $output = 
+  $output =
     '<div class="term-reference-track-list-container">
        <div class="term-reference-track-list-label">' . $label . '</div>
        <ul class="term-reference-tree-track-list"><li class="term_ref_tree_nothing_message">'.$nothingselected.'</li></ul>
      </div>';
-     
+
   //Add the "Nothing selected" text. To style it, replace it with whatever you want.
   //Could do this with a file instead.
   drupal_add_js(
@@ -426,7 +426,7 @@ function term_reference_tree_field_widget_form(&$form, &$form_state, $field, $in
   $path = drupal_get_path('module', 'term_reference_tree');
   $value_key = key($field['columns']);
   $type = $instance['widget']['type'];
-  
+
   $default_value = array();
   foreach($items as $item) {
     $key = $item[$value_key];
@@ -449,7 +449,7 @@ function term_reference_tree_field_widget_form(&$form, &$form_state, $field, $in
     case 'term_reference_tree':
       $element['#attached']['js'] = array($path . '/term_reference_tree.js');
       $element['#attached']['css'] = array($path . '/term_reference_tree.css');
-      $element['#type'] = 'checkbox_tree';   
+      $element['#type'] = 'checkbox_tree';
       $element['#default_value'] = $multiple ? $default_value : array(reset($default_value) => reset($default_value));
       $element['#max_choices'] = $field['cardinality'];
       $element['#start_minimized'] = $settings['start_minimized'];
@@ -462,7 +462,7 @@ function term_reference_tree_field_widget_form(&$form, &$form_state, $field, $in
       $element['#token_display'] = module_exists('token') ? $settings['token_display'] : '';
       break;
   }
-  
+
   $element += array(
     '#value_key' => $value_key,
     '#element_validate' => array('_term_reference_tree_widget_validate'),
@@ -475,16 +475,16 @@ function term_reference_tree_field_widget_form(&$form, &$form_state, $field, $in
 
 /**
  * Validates the term reference tree widgets.
- * 
+ *
  * This function sets the value of the tree widgets into a form that Drupal
  * can understand, and also checks if the field is required and has been
  * left empty.
- * 
+ *
  * @param $element
  *   The element to be validated.
  * @param $form_state
  *   The state of the form.
- * 
+ *
  * @return
  *   The validated element.
  */
@@ -506,7 +506,7 @@ function _term_reference_tree_widget_validate(&$element, &$form_state) {
             }
           }
         }
-      } 
+      }
     }
   }
   else {
@@ -516,10 +516,10 @@ function _term_reference_tree_widget_validate(&$element, &$form_state) {
       $child = reset($items);
       if (array_key_exists('#value', $child) && $child['#value'] !== 0) {
         array_push($value, array($element['#value_key'] => $child['#value']));
-      }       
+      }
     }
   }
-  
+
   if ($element['#required'] && empty($value)) {
     form_error($element, t('!name field is required.', array('!name' => $element['#title'])));
   }
@@ -600,7 +600,7 @@ function _term_reference_tree_build_item(&$element, &$term, &$form_state, &$valu
   if (array_key_exists('#leaves_only', $element)) {
     $leaves_only = $element['#leaves_only'];
   }
-  
+
   $container = array(
     '#type' => 'checkbox_tree_item',
     '#max_choices' => $max_choices,
@@ -642,7 +642,7 @@ function _term_reference_tree_build_item(&$element, &$term, &$form_state, &$valu
   }
 
   $container[$term->tid] = $e;
-  
+
 
   if (property_exists($term, 'children') && count($term->children) > 0) {
     $parents = $parent_tids;
@@ -684,7 +684,7 @@ function _term_reference_tree_build_level(&$element, &$term, &$form_state, &$val
   if (array_key_exists('#leaves_only', $element)) {
     $leaves_only = $element['#leaves_only'];
   }
-  
+
   $container = array(
     '#type' => 'checkbox_tree_level',
     '#max_choices' => $max_choices,
@@ -695,6 +695,6 @@ function _term_reference_tree_build_level(&$element, &$term, &$form_state, &$val
   foreach($term->children as $t) {
     $container[$t->tid] = _term_reference_tree_build_item($element, $t, $form_state, $value, $max_choices, $parent_tids);
   }
-  
+
   return $container;
 }
