diff --git modules/hs_content_taxonomy.admin.inc modules/hs_content_taxonomy.admin.inc
index e69de29..90669b7 100644
--- modules/hs_content_taxonomy.admin.inc
+++ modules/hs_content_taxonomy.admin.inc
@@ -0,0 +1,99 @@
+<?php
+/**
+ * Form definition; configuration form for Hierarchical Select as the widget
+ * for a content_taxonomy field.
+ *
+ * @param $content_type_name
+ *   Name of a content type. Provides necessary context.
+ * @param $field_name
+ *   Name of a field. Provides necessary context.
+ */
+function hs_content_taxonomy_config_form($form_state, $content_type_name, $field_name) {
+  require_once(drupal_get_path('module', 'hierarchical_select') .'/includes/common.inc');
+
+  drupal_add_css(drupal_get_path('module', 'hs_content_taxonomy') .'/hs_content_taxonomy.css');
+
+  $content_type = content_types($content_type_name);
+
+  $field = $content_type['fields'][$field_name];
+
+  // Extract the necessary context from the $field array.
+  $vid = $field['vid'];
+  $tid = $field['tid'];
+  $depth = (empty($field['depth'])) ? 0 : $field['depth'];
+
+  // Add the Hierarchical Select config form.
+  $module = 'hs_content_taxonomy';
+  $params = array(
+    'vid'   => $vid,
+    'tid'   => $tid,
+    'depth' => $depth,
+  );
+  $config_id = "content-taxonomy-$field_name";
+  $vocabulary = taxonomy_vocabulary_load($vid);
+  $defaults = array(
+  // Enable the save_lineage setting by default if the multiple parents
+  // vocabulary option is enabled.
+    'save_lineage' => (int) ($vocabulary->hierarchy == 2),
+    'editability' => array(
+      'max_levels' => min($depth, _hs_taxonomy_hierarchical_select_get_depth($vid)),
+    ),
+  );
+  // If this config is being created (not edited), then enable the dropbox if
+  // this is a "multiple values" field. This allows for an intuitive
+  // transition to a Hierarchical Select widget.
+  if (variable_get('hs_config_'. $config_id, FALSE) === FALSE) {
+    $defaults['dropbox']['status'] = $field['multiple'];
+  }
+  $strings = array(
+    'hierarchy'   => t('vocabulary'),
+    'hierarchies' => t('vocabularies'),
+    'item'        => t('term'),
+    'items'       => t('terms'),
+    'item_type'   => t('term type'),
+    'entity'      => t('node'),
+    'entities'    => t('nodes'),
+  );
+  $max_hierarchy_depth = min(($depth == 0) ? 9 : $depth, _hs_taxonomy_hierarchical_select_get_depth($vid));
+  $preview_is_required = $field['required'];
+  $form['hierarchical_select_config'] = hierarchical_select_common_config_form($module, $params, $config_id, $defaults, $strings, $max_hierarchy_depth, $preview_is_required);
+
+  $form['link'] = array(
+    '#value' => l('Back to the field configuration', 'admin/content/node-type/'. $content_type['type'] .'/fields/'. $field_name),
+    '#prefix' => '<div class="cck-hierarchical-select-back-link">',
+    '#suffix' => '</div>',
+    '#weight' => -5,
+  );
+
+  $form['save'] = array(
+    '#type' => 'submit',
+    '#value' => t('Save'),
+  );
+  $form['#content_type_name'] = $content_type_name;
+  $form['#field_name'] = $field_name;
+
+  // Add the the submit handler for the Hierarchical Select config form.
+  $parents = array('hierarchical_select_config');
+  $form['#submit'][] = 'hierarchical_select_common_config_form_submit';
+  $form['#hs_common_config_form_parents'] = $parents;
+
+  $form['#submit'][] = 'hs_content_taxonomy_common_config_form_submit';
+
+  return $form;
+}
+
+/**
+ * Additional submit callback to update the multiple values field setting.
+ */
+function hs_content_taxonomy_common_config_form_submit( &$form, &$form_state) {
+  $config = $form_state['values']['hierarchical_select_config'];
+  $multiple_values = ($config['save_lineage'] | $config['dropbox']['status']);
+  $content_type = content_types($form['#content_type_name']);
+  $field = $content_type['fields'][$form['#field_name']];
+  $form_state_new = array();
+  $form_state_new['values'] = array(
+    'multiple'    => $multiple_values,
+  );
+  require_once(drupal_get_path('module', 'content') .'/includes/content.admin.inc');
+  drupal_execute('content_field_edit_form', $form_state_new, $field['type_name'], $form['#field_name']);
+}
diff --git modules/hs_content_taxonomy.info modules/hs_content_taxonomy.info
index 745289f..30a88fd 100644
--- modules/hs_content_taxonomy.info
+++ modules/hs_content_taxonomy.info
@@ -1,12 +1,8 @@
 ; $Id: hs_content_taxonomy.info,v 1.2 2008/06/28 18:25:28 wimleers Exp $
 name = Hierarchical Select Content Taxonomy
 description = Use Hierarchical Select as the widget for Content Taxonomy CCK fields.
-dependencies = hierarchical_select content_taxonomy hs_taxonomy
+dependencies[] = hierarchical_select 
+dependencies[] = content_taxonomy
+dependencies[] = hs_taxonomy
 package = Form Elements
-
-; Information added by drupal.org packaging script on 2009-08-05
-version = "6.x-3.x-dev"
 core = "6.x"
-project = "hierarchical_select"
-datestamp = "1249474740"
-
diff --git modules/hs_content_taxonomy.module modules/hs_content_taxonomy.module
index bebfe92..0b1b296 100644
--- modules/hs_content_taxonomy.module
+++ modules/hs_content_taxonomy.module
@@ -1,5 +1,5 @@
 <?php
-// $Id: hs_content_taxonomy.module,v 1.33 2008/12/01 02:21:17 wimleers Exp $
+// $Id$
 
 /**
  * @file
@@ -7,7 +7,6 @@
  * module.
  */
 
-
 /**
  * TRICKY: Content Taxonomy's depth setting:
  * - 0 means the entire tree
@@ -16,185 +15,80 @@
  * - etc.
  */
 
-
-define('HS_CONTENT_TAXONOMY_SEPARATOR', '<span class="hierarchical-select-item-separator">›</span>');
-
-
 //----------------------------------------------------------------------------
 // Core hooks.
 
 /**
  * Implementation of hook_menu().
  */
-function hs_content_taxonomy_menu($may_cache) {
-  $items = array();
-
-  if (!$may_cache) {
-    $context = _hs_content_taxonomy_parse_context_from_url();
-    if (is_array($context)) {
-      list($content_type_name, $field_name) = $context;
-
-      $content_type = content_types($content_type_name);
-
-      $items[] = array(
-        'path' => 'admin/content/types/'. $content_type['url_str'] .'/fields/'. $field_name .'/hs_config',
-        'title' => t('Hierarchical Select configuration for !field', array('!field' => $content_type['fields'][$field_name]['widget']['label'])),
-        'callback' => 'drupal_get_form',
-        'callback arguments' => array('hs_content_taxonomy_config_form', $content_type['type'], $field_name),
-        'access' => user_access('administer content types'),
-        'type' => MENU_CALLBACK,
-      );
-    }
-  }
+function hs_content_taxonomy_menu() {
+  $items['admin/content/node-type/%/fields/%/hs_config'] = array(
+    'title'            => t('HS config'),
+    'access arguments' => array('administer site configuration'),
+    'page callback'    => 'drupal_get_form',
+    'page arguments'   => array('hs_content_taxonomy_config_form', 3, 5),
+    'type'             => MENU_NORMAL_ITEM,
+    'file'             => 'hs_content_taxonomy.admin.inc',
+  );
   return $items;
 }
 
-
 /**
  * Implementation of hook_form_alter().
  */
-function hs_content_taxonomy_form_alter($form_id, &$form) {
-  if ($form_id == '_content_admin_field') {
-    if ($form['widget']['widget_type']['#default_value'] == 'content_taxonomy_hs') {
-      // Hide the "multiple values" setting, so the user can't change it.
-      $form['field']['multiple']['#type'] = 'hidden';
-
-      // Add a fake checkbox form item to indicate the current state of this
-      // setting. Because this checkbox is disabled, it won't be submitted,
-      // and that's why we have to add a fake form item.
-      $split = array_search('multiple', array_keys($form['field'])) + 1;
-      $first_part = array_slice($form['field'], 0, $split);
-      $second_part = array_slice($form['field'], $split);
-      $form['field'] = $first_part;
-      $form['field']['fake_multiple'] = $form['field']['multiple'];
-      $form['field']['fake_multiple']['#type'] = 'checkbox';
-      $form['field']['fake_multiple']['#attributes'] = array('disabled' => 'disabled');
-      $form['field']['fake_multiple']['#description'] = t(
-        'This setting is now managed by the Hierarchical Select widget
-        configuration!'
-      );
-      $form['field'] += $second_part;
+function hs_content_taxonomy_form_alter(&$form, &$form_state, $form_id) {
+  if (isset($form['type']) && $form['type']['#value'] .'_node_form' == $form_id) {
+    if (sizeof($form['#field_info']) > 0) {
+      foreach ($form['#field_info'] as $field_name => &$field_info) {
+        if ($field_info['widget']['type'] == 'content_taxonomy_hs') {
+          $form['#submit'][] = 'hs_content_taxonomy_form_submit';
+          break;
+        }
+      }
     }
   }
 }
 
-
-//----------------------------------------------------------------------------
-// Forms API callbacks.
-
 /**
- * Form definition; configuration form for Hierarchical Select as the widget
- * for a content_taxonomy field.
- *
- * @param $content_type_name
- *   Name of a content type. Provides necessary context.
- * @param $field_name
- *   Name of a field. Provides necessary context.
+ * Implementation of hook_form_FORM_ID_alter()
  */
-function hs_content_taxonomy_config_form($content_type_name, $field_name) {
-  require_once(drupal_get_path('module', 'hierarchical_select') .'/includes/common.inc');
-
-  drupal_add_css(drupal_get_path('module', 'hs_content_taxonomy') .'/hs_content_taxonomy.css');
-
-  $content_type = content_types($content_type_name);
-  $field = $content_type['fields'][$field_name];
-
-  // Extract the necessary context from the $field array.
-  $vid = $field['vid'];
-  $tid = $field['tid'];
-  $depth = (empty($field['depth'])) ? 0 : $field['depth'];
-
-  // Add the Hierarchical Select config form.
-  $module = 'hs_content_taxonomy';
-  $params = array(
-    'vid'   => $vid,
-    'tid'   => $tid,
-    'depth' => $depth,
-  );
-  $config_id = "content-taxonomy-$field_name";
-  $vocabulary = taxonomy_get_vocabulary($vid);
-  $defaults = array(
-    // Enable the save_lineage setting by default if the multiple parents
-    // vocabulary option is enabled.
-    'save_lineage' => (int) ($vocabulary->hierarchy == 2),
-    'editability' => array(
-      'max_levels' => min($depth, _hs_taxonomy_hierarchical_select_get_depth($vid)),
-    ),
-  );
-  // If this config is being created (not edited), then enable the dropbox if
-  // this is a "multiple values" field. This allows for an intuitive
-  // transition to a Hierarchical Select widget.
-  if (variable_get('hs_config_'. $config_id, FALSE) === FALSE) {
-    $defaults['dropbox']['status'] = $field['multiple'];
+function hs_content_taxonomy_form_content_field_edit_form_alter(&$form, &$form_state) {  
+  if ($form['#field']['widget']['type'] == 'content_taxonomy_hs') {
+    $form['field']['multiple']['#attributes'] = array('disabled' => 'disabled');
+    $form['field']['multiple']['#description'] = t(
+      'This setting is now managed by the Hierarchical Select widget configuration!'
+    );     
   }
-  $strings = array(
-    'hierarchy'   => t('vocabulary'),
-    'hierarchies' => t('vocabularies'),
-    'item'        => t('term'),
-    'items'       => t('terms'),
-    'item_type'   => t('term type'),
-    'entity'      => t('node'),
-    'entities'    => t('nodes'),
-  );
-  $max_hierarchy_depth = min(($depth == 0) ? 9 : $depth, _hs_taxonomy_hierarchical_select_get_depth($vid));
-  $preview_is_required = $field['required'];
-  $form['hierarchical_select_config'] = hierarchical_select_common_config_form($module, $params, $config_id, $defaults, $strings, $max_hierarchy_depth, $preview_is_required);
-
-  $form['link'] = array(
-    '#value' => l('Back to the field configuration', 'admin/content/types/'. $content_type['url_str'] .'/fields/'. $field_name),
-    '#prefix' => '<div class="cck-hierarchical-select-back-link">',
-    '#suffix' => '</div>',
-    '#weight' => -5,
-  );
-
-  $form['save'] = array(
-    '#type' => 'submit',
-    '#value' => t('Save'),
-  );
-
-  // Add the the submit handler for the Hierarchical Select config form.
-  $parents = array('hierarchical_select_config');
-  $form['#submit']['hierarchical_select_common_config_form_submit'] = array($parents);
+}
 
-  $form['#submit']['hs_content_taxonomy_common_config_form_submit'] = array($content_type_name, $field_name);
 
-  return $form;
-}
+//----------------------------------------------------------------------------
+// Forms API callbacks.
 
 /**
- * Additional submit callback to update the multiple values field setting.
+ * Submit handler for HS CT field form
  */
-function hs_content_taxonomy_common_config_form_submit($form_id, $form_state['values'], $content_type_name, $field_name) {
-  $config = $form_state['values']['hierarchical_select_config'];
-  $multiple_values = ($config['save_lineage'] | $config['dropbox']['status']);
-
-  $content_type = content_types($content_type_name);
-  $field = $content_type['fields'][$field_name];
-
-  $form_state['values'] = array(
-    'widget_type' => 'content_taxonomy_hs',
-    'label'       => $field['widget']['label'],
-    'weight'      => $field['widget']['weight'],
-    'description' => $field['widget']['description'],
-    'required'    => $field['required'],
-    'multiple'    => $multiple_values,
-    'save'        => $field['save'],
-    'vid'         => $field['vid'],
-    'tid'         => $field['tid'],
-    'depth'       => $field['depth'],
-    'op'          => t('Save field settings'),
-    'submit'      => t('Save field settings'),
-    'type_name'   => $field['type_name'],
-    'field_name'  => $field_name,
-    'field_type'  => 'content_taxonomy',
-    'module'      => 'content_taxonomy, hs_content_taxonomy',
-    'form_id'     => '_content_admin_field',
-  );
-
-  drupal_execute('_content_admin_field', $form_state['values'], $field['type_name'], $field_name);
+function hs_content_taxonomy_form_submit(&$form, &$form_state) {
+  foreach ($form['#field_info'] as $field_name => $field_info) {
+    if ($field_info['widget']['type'] == 'content_taxonomy_hs') {
+      // Change format of values to the one Content Taxonomy expects
+      if (is_array($form_state['values'][$field_name]['tids'])) {
+        $values = array();
+        foreach($form_state['values'][$field_name]['tids'] as $tid) {
+          $values[] = array('value' => $tid);
+          array_unshift($form_state['values'][$field_name], array('value' => $tid));
+        }
+        $form_state['values'][$field_name]['tids'] = $values;
+      }
+      else {
+        $values[] = array('value' => $form_state['values'][$field_name]['tids']);
+        array_unshift($form_state['values'][$field_name],array('value' => $form_state['values'][$field_name]['tids']));
+        $form_state['values'][$field_name]['tids'] = $values;
+      }
+    }
+  }
 }
 
-
 //----------------------------------------------------------------------------
 // CCK hooks.
 
@@ -206,6 +100,10 @@ function hs_content_taxonomy_widget_info() {
     'content_taxonomy_hs' => array( // 'content_taxonomy_hs' instead of 'content_taxonomy_hierarchical_select' due to CCK limitations.
       'label'       => 'Hierarchical Select',
       'field types' => array('content_taxonomy'),
+      // Set multiple settings to be handled by widget rather than by CCK itself
+      'multiple values' => CONTENT_HANDLE_MODULE,
+      // No default value callback for this widget
+      'callbacks' => array('default value' => CONTENT_CALLBACK_NONE),
     ),
   );
 }
@@ -217,30 +115,23 @@ function hs_content_taxonomy_widget_settings($op, $widget) {
   switch ($op) {
     case 'form':
       drupal_add_css(drupal_get_path('module', 'hs_content_taxonomy') .'/hs_content_taxonomy.css');
-
       $context = _hs_content_taxonomy_parse_context_from_url();
       list($content_type_name, $field_name) = $context;
-      $content_type = content_types($content_type_name);
-
-      $url = 'admin/content/types/'. $content_type['url_str'] .'/fields/'. $field_name .'/hs_config';
-
+      $url = 'admin/content/node-type/'. $content_type_name .'/fields/'. $field_name .'/hs_config';
       $items[] = t(
-        "Due to limitations of CCK, there is a separate form to
-        <a href=\"!url\"> configure this Hierarchical Select widget's
-        settings.</a>",
-        array('!url' => url($url))
+        "Due to limitations of CCK, there is a separate form to <a href=\"!url\">
+        configure this Hierarchical Select widget's settings.</a>",array('!url' => url($url))
+      );
+      $placeholders = array(
+        '%multiple_values'    => t('Multiple values'),
+        '%enable_the_dropbox' => t('Enable the dropbox'),
+        '%save_term_lineage'  => t('Save term lineage'),
       );
       $items[] = t(
         'The %multiple_values field setting is now managed by the Hierarchical
         Select module: it will be enabled when either the %enable_the_dropbox
-        or %save_term_lineage settings (or both) are enabled.',
-        array(
-          '%multiple_values'    => t('Multiple values'),
-          '%enable_the_dropbox' => t('Enable the dropbox'),
-          '%save_term_lineage'  => t('Save term lineage'),
-        )
+        or %save_term_lineage settings (or both) are enabled.', $placeholders
       );
-
       $form['hs_config'] = array(
         '#type' => 'fieldset',
         '#title' => t('Hierarchical Select configuration'),
@@ -249,86 +140,71 @@ function hs_content_taxonomy_widget_settings($op, $widget) {
           '</p>'. theme('item_list', $items),
         '#collapsible' => FALSE,
       );
-
       return $form;
 
     case 'callbacks':
-      return array(
-        'default value' => CONTENT_CALLBACK_NONE,
-      );
-    }
+      return array('default value' => CONTENT_CALLBACK_NONE);
+  }
 }
 
 /**
  * Implementation of hook_widget().
  */
-function hs_content_taxonomy_widget($op, &$node, $field, &$node_field) {
-  if ($field['widget']['type'] == 'content_taxonomy_hs') {
-    $field_name = $field['field_name'];
-    $vid        = $field['vid'];
-    $tid        = $field['tid'];
-    $depth      = (empty($field['depth'])) ? 0 : $field['depth'];
-
-    switch ($op) {
-      case 'form':
-        require_once(drupal_get_path('module', 'hierarchical_select') .'/includes/common.inc');
-
-        $form[$field_name]['#tree'] = TRUE;
-        $form[$field_name]['tids'] = array(
-          '#title' => $field['widget']['label'],
-          '#type' => 'hierarchical_select',
-          '#weight' => $field['widget']['weight'],
-          '#config' => array(
-            'module' => 'hs_content_taxonomy',
-            'params' => array(
-              'vid'   => $vid,
-              'tid'   => $tid,
-              'depth' => $depth,
-            ),
-          ),
-          '#required' => $field['required'],
-          '#description' => t($field['widget']['description']),
-          // The default value comes from $node_field (thus from the CCK
-          // storage), unless it's empty, then we check if $node->taxonomy
-          // (thus 'normal' Taxonomy storage) contains a value, and use that
-          // instead, unless that's empty too.
-          // The latter will only work reliably if only one content_taxonomy
-          // field is being used, because when you have multiple
-          // content_taxonomy fields that use the same vocabulary, there's no
-          // way to distinguish.
-          '#default_value' => ((is_array($node_field[$tid])) ? array_keys($node_field[$tid]) : ((is_array($node->taxonomy)) ? array_keys($node->taxonomy) : array())),
-        );
-        hierarchical_select_common_config_apply($form[$field_name]['tids'], "content-taxonomy-$field_name");
-        return $form;
-
-      case 'process form values':
-        // TRICKY: this piece of utterly ugly, crappy and dysfunctional code
-        // is here thanks to the ugly internal works of the content_taxonomy
-        // module that don't make any sense at all. It's necessary to support
-        // the 'both' (and 'cck') "save option" of content_taxonomy.
-        if (isset($field['save']) && $field['save'] != 'tag') {
-          if ($field['multiple'] && is_array($node_field['tids'])) {
-            foreach ($node_field['tids'] as $key => $tid) {
-              if ($tid != 0) {
-                $keys[$tid] = $tid;
-              }
-            }
-          }
-          else {
-            $keys[$node_field['tids']] = $node_field['tids'];
-          }
-          $node_field = content_transpose_array_rows_cols(array('value' => $keys));
-        }
-        else {
-          if (!$field['multiple']) {
-            $value = $node_field['tids'];
-            $node_field['tids'] = array();
-            $node_field['tids'][0] = $value;
-          }
-        }
-        break;
-    }
+function hs_content_taxonomy_widget(&$form, &$form_state, $field, $items, $delta = 0) {
+  $field_name = $field['field_name'];
+  $vid        = $field['vid'];
+  $tid        = content_taxonomy_field_get_parent($field);
+  $depth      = (empty($field['depth'])) ? 0 : $field['depth'];
+  require_once(drupal_get_path('module', 'hierarchical_select') .'/includes/common.inc');
+  $node = &$form['#node'];
+  foreach ($items as $item) {
+    $selected_items[] = $item['value'];
   }
+  $node_field = &$node->$field_name;
+  $form[$field_name]['#tree'] = TRUE;
+  $form[$field_name]['#weight'] = $field['widget']['weight'];
+  $form[$field_name]['tids'] = array(
+    '#title' => $field['widget']['label'],
+    '#type' => 'hierarchical_select',
+    '#weight' => $field['widget']['weight'],
+    '#config' => array(
+      'module' => 'hs_content_taxonomy',
+      'params' => array(
+        'vid'   => $vid,
+        'tid'   => $tid,
+        'depth' => $depth,
+      ),
+    ),
+    '#required' => $field['required'],
+    '#description' => t($field['widget']['description']),
+	'#default_value' => !empty($selected_items) ? array_values($selected_items) : array(),
+  );
+  unset($form[$field_name]['#options']); // Unset to prevent passing around of possibly huge HTML.
+  unset($form[$field_name]['#theme']);   // Unset to prevent theme_taxonomy_term_select() from running.
+  hierarchical_select_common_config_apply($form[$field_name]['tids'], "content-taxonomy-$field_name");
+  return $form;
+}
+
+//-------------------------------------------------------------------------------------------------------
+// HS Content Taxonomy CCK formatters
+
+/**
+ * Implementation of hook_theme().
+ */
+function hs_content_taxonomy_theme() {
+  return array(
+    'hs_content_taxonomy_formatter_hierarchical_text' => array(
+      'arguments' => array('element' => NULL),
+      'function' => 'theme_hs_content_taxonomy_formatter_hierarchical',
+    ),
+    'hs_content_taxonomy_formatter_hierarchical_links' => array(
+      'arguments' => array('element' => NULL),
+      'function' => 'theme_hs_content_taxonomy_formatter_hierarchical',
+    ),
+    'hs_content_taxonomy_row' => array(
+      'arguments' => array('row' => NULL, 'type' => NULL),
+    ),
+  );
 }
 
 /**
@@ -337,30 +213,63 @@ function hs_content_taxonomy_widget($op, &$node, $field, &$node_field) {
 function hs_content_taxonomy_field_formatter_info() {
   return array(
     'hierarchical_text' => array(
-      'label' => 'As hierarchical text',
+      'label' => t('As hierarchical text'),
       'field types' => array('content_taxonomy'),
+      'multiple values' => CONTENT_HANDLE_MODULE,
     ),
     'hierarchical_links' => array(
-      'label' => 'As hierarchical links',
+      'label' => t('As hierarchical links'),
       'field types' => array('content_taxonomy'),
+      'multiple values' => CONTENT_HANDLE_MODULE,
     ),
   );
 }
 
 /**
- * Implemenation of hook_field_formatter().
+ *  Theme function to output single row (lineage) of CT field
+ *
+ *  Giving levels different classes so some funny theming is possible:
+ *  for example, different font size depending on level (like tagadelic)
  */
-function hs_content_taxonomy_field_formatter($field, $item, $formatter, $node) {
+function theme_hs_content_taxonomy_row($row, $type) {
+  $separator = '<span class="hierarchical-select-item-separator">›</span>';
   $output = '';
-
-  if (!is_array($item)) {
+  if (empty($row)) {
     return $output;
   }
+  $items = array();
+  foreach ($row as $level => $item ) {
+    $term  = taxonomy_get_term($item['value']);
+    $line  = '<span class="lineage-item lineage-item-level-'. $level .'">';
+    // Depending on which formatter is active, create links or use labels.
+    switch ($type) {
+      case 'hierarchical_links':
+        $line .= l($term->name, taxonomy_term_path($term), array('rel' => 'tag', 'title' => $term->description));
+        break;
+      case 'hierarchical_text':
+        $line .= $item['label'];
+        break;
+    }
+    $line .= '</span>';
+    $items[] = $line;
+  }
+  $output = implode($separator , $items);
+  return $output;
+}
+
+/**
+ * Theme function for HS Content Taxonomy formatters.
+ *
+ */
+function theme_hs_content_taxonomy_formatter_hierarchical($element) {
+  $output = '';
 
   // Extract required field information.
+  // $element contains only field name; so we use cck function to get more info.
+  $field = content_fields($element['#field_name'], $element['#type_name']);
   $field_name = $field['field_name'];
   $vid        = $field['vid'];
-  $tid        = $field['tid'];
+  $tid        = (empty($field['tid'])) ? 0 : $field['tid'];
   $depth      = (empty($field['depth'])) ? 0 : $field['depth'];
 
   // Get the config for this field.
@@ -375,40 +284,51 @@ function hs_content_taxonomy_field_formatter($field, $item, $formatter, $node) {
       'depth' => $depth,
     ),
   );
+  $selection = array();
+
+  // Cycle through elements.
+  foreach (element_children($element) as $key) {
+    if (isset($element[$key]['#item']['value'])) {
+      $selection[] = $element[$key]['#item']['value'];
+    }
+  }
+  // It is said that formatter theme function is called even if field is empty.
+  if (empty($selection)) {
+    return $output;
+  }
 
   // Generate a dropbox out of the selection. This will automatically
   // calculate all lineages for us.
-  $selection = array_keys($item);
   $dropbox = _hierarchical_select_dropbox_generate($config, $selection);
 
   // Actual formatting.
-  $separator = HS_CONTENT_TAXONOMY_SEPARATOR;
-  foreach ($dropbox->lineages as $id => $lineage) {
-    if ($id > 0) {
-      $output .= '<br />';
+  // In 6.x formatter is fully themable
+  // We theme each lineage using additional theme function
+  $num_items = count($dropbox->lineages);
+  $flip = array('even' => 'odd', 'odd' => 'even');
+  $class = 'even';
+
+  $output = '<ul class="hierarchical-select-lineages">';
+  foreach ($dropbox->lineages as $i => $lineage) {
+    $class = $flip[$class];
+    $classes = ' '. $class;
+    if ($i == 0) {
+      $classes .= ' first';
     }
-
-    $items = array();
-    foreach ($lineage as $level => $item) {
-      // Depending on which formatter is active, create links or use labels.
-      if ($formatter == 'hierarchical_links') {
-        $term = taxonomy_get_term($item['value']);
-        $items[] = l($term->name, taxonomy_term_path($term), array('rel' => 'tag', 'title' => $term->description));
-      }
-      else {
-        $items[] = $item['label'];
-      }
+    if ($i == $num_items - 1) {
+      $classes .= ' last';
     }
-    $output .= implode($separator, $items);
+    $output .= '<li class="lineage-'. $i . $classes .'">';
+    $output .= theme('hs_content_taxonomy_row', $lineage, $element['#formatter']);
+    $output .= '</li>';
   }
+  $output .= '</ul>';
 
   // Add the CSS.
   drupal_add_css(drupal_get_path('module', 'hierarchical_select') .'/hierarchical_select.css');
-
   return $output;
 }
 
-
 //----------------------------------------------------------------------------
 // Hierarchical Select hooks.
 
@@ -428,7 +348,8 @@ function hs_content_taxonomy_hierarchical_select_params() {
  * Implementation of hook_hierarchical_select_root_level().
  */
 function hs_content_taxonomy_hierarchical_select_root_level($params) {
-  $terms = _hs_taxonomy_hierarchical_select_get_tree($params['vid'], $params['tid'], -1, 1);
+  $tid = $params['tid'];
+  $terms = _hs_taxonomy_hierarchical_select_get_tree($params['vid'], $tid, -1, 1);
   return _hs_taxonomy_hierarchical_select_terms_to_options($terms);
 }
 
@@ -437,13 +358,12 @@ function hs_content_taxonomy_hierarchical_select_root_level($params) {
  */
 function hs_content_taxonomy_hierarchical_select_children($parent, $params) {
   static $tree;
-
-  $vid   = $params['vid'];
-  $tid   = $params['tid'];
+  $vid = $params['vid'];
+  $tid = $params['tid'];
   $depth = $params['depth'];
 
   // Keep a static cache of the entire tree, this allows us to quickly look up
-  // if a term is not to deep – because if it's too deep, we don't want to
+  // if a term is not too deep – because if it's too deep, we don't want to
   // return any children.
   if (!isset($tree[$vid][$tid])) {
     $raw_tree = _hs_taxonomy_hierarchical_select_get_tree($vid, $tid);
@@ -480,7 +400,6 @@ function hs_content_taxonomy_hierarchical_select_lineage($item, $params) {
       array_shift($lineage);
     }
   }
-
   return $lineage;
 }
 
@@ -492,6 +411,8 @@ function hs_content_taxonomy_hierarchical_select_valid_item($item, $params) {
     return FALSE;
   }
   $term = taxonomy_get_term($item);
+  // Bug: tid isn't set to zero for some reason when root term is not set, so we make workaround for this
+  //$params['tid'] = $params['tid'] ? $params['tid']: 0;
   return ($term->vid == $params['vid'] && _hs_content_taxonomy_term_within_allowed_depth($term->tid, $term->vid, $params['tid'], $params['depth']));
 }
 
@@ -544,7 +465,7 @@ function hs_content_taxonomy_hierarchical_select_config_info() {
       if ($field['type'] == 'content_taxonomy') {
         foreach ($content_types as $content_type_name => $content_type) {
           if (isset($content_type['fields'][$field_name]) && $content_type['fields'][$field_name]['widget']['type'] == 'content_taxonomy_hs') {
-            $vocabulary = taxonomy_get_vocabulary($field['vid']);
+            $vocabulary = taxonomy_vocabulary_load($field['vid']);
 
             $config_id = "content-taxonomy-$field_name";
             $config_info["$config_id|$content_type_name"] = array(
@@ -555,14 +476,13 @@ function hs_content_taxonomy_hierarchical_select_config_info() {
               'entity'         => t($content_type['name']),
               'context type'   => t('Node form'),
               'context'        => '',
-              'edit link'      => "admin/content/types/$content_type_name/fields/$field_name/hs_config",
+              'edit link'      => "admin/content/node-type/$content_type_name/fields/$field_name/hs_config",
             );
           }
         }
       }
     }
   }
-
   return  $config_info;
 }
 
@@ -578,9 +498,8 @@ function hs_content_taxonomy_hierarchical_select_config_info() {
  *   - array($content_type_name, $field_name) otherwise
  */
 function _hs_content_taxonomy_parse_context_from_url() {
-  if (arg(0) == 'admin' && arg(1) == 'content' && arg(2) == 'types') {
+  if (arg(0) == 'admin' && arg(1) == 'content' && arg(2) == 'node-type') {
     $content_type = content_types(arg(3));
-    $type = node_get_types('types', $content_type['type']);
 
     $field_name = arg(5);
 
