diff --git a/contrib/current_search/current_search.block.inc b/contrib/current_search/current_search.block.inc
index 1bf2f63..66bc5b1 100644
--- a/contrib/current_search/current_search.block.inc
+++ b/contrib/current_search/current_search.block.inc
@@ -5,6 +5,21 @@
  * Block hook implementations and block form alterations.
  */
 
+
+/**
+ * Implements hook_block().
+ */
+function current_search_block($op = 'list', $delta = 0, $edit = array()) {
+  switch ($op) {
+    case 'list' :
+      return current_search_block_info();
+      break;
+    case 'view' :
+      return current_search_block_view($delta);
+      break;
+  }
+}
+
 /**
  * Implements hook_form_FORM_ID_alter().
  *
@@ -26,9 +41,7 @@ function current_search_form_block_admin_configure_alter(&$form, &$form_state) {
     );
 
     // Gets the default value for this block.
-    $searcher = db_query("SELECT searcher FROM {block_current_search} WHERE delta = :delta", array(
-      ':delta' => $form['delta']['#value'],
-    ))->fetchField();
+    $searcher = db_result(db_query("SELECT searcher FROM {block_current_search} WHERE delta = %d", $form['delta']['#value']));
 
     $form['visibility']['current_search']['searcher'] = array(
       '#type' => 'radios',
@@ -106,28 +119,24 @@ function current_search_block_view($delta = '') {
   // Makes sure the adapter and configuration can be loaded.
   $adapter = facetapi_adapter_load($searcher);
   if ($adapter && ($config = ctools_export_crud_load('current_search', $delta))) {
-    $build = array();
-
+    $content = '';
     // Iterates over configs and executes the plugins.
     foreach ($config->settings['items'] as $name => $settings) {
       if ($class = ctools_plugin_load_class('current_search', 'items', $settings['id'], 'handler')) {
         $plugin = new $class($name, $config);
         if ($return = $plugin->execute($adapter)) {
-          $build[$name] = $return;
-          $build[$name]['#theme_wrappers'][] = 'current_search_item_wrapper';
-          $build[$name]['#current_search_id'] = $settings['id'];
+          if (!empty($return['#theme'])) {
+            $content .= theme($return['#theme'], $return['#items'], NULL, 'ul', $return['#attributes']);
+          }
         }
       }
     }
 
     // Returns the block content.
-    if ($build) {
-      $build['#contextual_links'] = array(
-        'current_search' => array('admin/settings/current_search/list', array($delta)),
-      );
+    if (!empty($content)) {
       return array(
         'subject' => t('Current search'),
-        'content' => $build,
+        'content' => $content,
       );
     }
   }
diff --git a/contrib/current_search/current_search.module b/contrib/current_search/current_search.module
index 45bfdd3..a46ecc2 100644
--- a/contrib/current_search/current_search.module
+++ b/contrib/current_search/current_search.module
@@ -122,19 +122,21 @@ function current_search_ctools_plugin_api($owner, $api) {
  * Implements hook_ctools_plugin_directory().
  */
 function current_search_ctools_plugin_directory($module, $type) {
-  if ('export_ui' == $type) {
+  if ('ctools' == $module && 'export_ui' == $type) {
     return 'plugins/export_ui';
   }
+
+  if ('current_search' == $module) {
+    return 'plugins/current_search';
+  }
 }
 
 /**
  * Implements hook_ctools_plugin_type().
  */
-function current_search_ctools_plugin_type() {
+function current_search_ctools_plugin_items() {
   return array(
-    'items' => array(
       'use hooks' => TRUE,
-    ),
   );
 }
 
@@ -146,6 +148,7 @@ function current_search_ctools_plugin_type() {
  */
 function current_search_get_plugins() {
   $plugins = &ctools_static(__FUNCTION__, array());
+
   if (!$plugins) {
     foreach (ctools_get_plugins('current_search', 'items') as $id => $plugin) {
       $plugins[$id] = $plugin['handler']['label'];
@@ -187,23 +190,43 @@ function current_search_item_load($name) {
  * Implements hook_current_search_items().
  */
 function current_search_current_search_items() {
+  $path = drupal_get_path('module', 'current_search') .'/plugins/current_search';
+
   return array(
+    'current_search_item' => array(
+      'handler' => array(
+        'label' => t('Abstract class for Current Search items'),
+        'class' => 'CurrentSearchItem',
+        'abstract' => TRUE,
+        'path' => $path,
+        'file' => 'item.inc'
+      )
+    ),
     'text' => array(
       'handler' => array(
         'label' => t('Custom text'),
         'class' => 'CurrentSearchItemText',
+        'parent' => 'current_search_item',
+        'path'  => $path,
+        'file'  => 'item_text.inc',
       ),
     ),
     'active' => array(
       'handler' => array(
         'label' => t('Active items'),
         'class' => 'CurrentSearchItemActive',
+        'parent' => 'current_search_item',
+        'path'  => $path,
+        'file'  => 'item_active.inc',
       ),
     ),
     'group' => array(
       'handler' => array(
         'label' => t('Field group'),
         'class' => 'CurrentSearchGroup',
+        'parent' => 'current_search_item',
+        'path'  => $path,
+        'file'  => 'item_group.inc',
       ),
     ),
   );
diff --git a/contrib/current_search/plugins/current_search/item_active.inc b/contrib/current_search/plugins/current_search/item_active.inc
index f9c0032..aa0a297 100644
--- a/contrib/current_search/plugins/current_search/item_active.inc
+++ b/contrib/current_search/plugins/current_search/item_active.inc
@@ -38,9 +38,8 @@ class CurrentSearchItemActive extends CurrentSearchItem {
       $item['adapter'] = $adapter;
 
       // Builds variables to pass to theme function.
-      $data = array('facetapi_active_item' => $item);
       $variables = array(
-        'text' => token_replace($pattern, $data),
+        'text' => token_replace($pattern, 'facetapi_active', $item),
         'path' => $this->getFacetPath($item, $adapter),
         'options' => array(
           'attributes' => $attributes,
diff --git a/contrib/current_search/plugins/current_search/item_group.inc b/contrib/current_search/plugins/current_search/item_group.inc
index 0b6da5c..da04b1e 100644
--- a/contrib/current_search/plugins/current_search/item_group.inc
+++ b/contrib/current_search/plugins/current_search/item_group.inc
@@ -64,8 +64,8 @@ class CurrentSearchGroup extends CurrentSearchItem {
         $build[$facet_name]['#theme_wrappers'] = array('current_search_group_wrapper');
 
         // Performs token replacemenets and themes the group title.
-        $data = array('facetapi_facet' => facetapi_facet_load($facet_name, $searcher));
-        $title = filter_xss(token_replace($field_pattern, $data));
+        $data = facetapi_facet_load($facet_name, $searcher);
+        $title = filter_xss(token_replace($field_pattern, 'facetapi_facet', $data));
         $build[$facet_name]['title']['#value'] = theme('current_search_group_title', array('title' => $title));
 
         // Builds the list.
diff --git a/contrib/current_search/plugins/current_search/item_text.inc b/contrib/current_search/plugins/current_search/item_text.inc
index 0b760d8..7322ee0 100644
--- a/contrib/current_search/plugins/current_search/item_text.inc
+++ b/contrib/current_search/plugins/current_search/item_text.inc
@@ -19,7 +19,7 @@ class CurrentSearchItemText extends CurrentSearchItem {
     // Determines plurality of string.
     if ($this->settings['plural']) {
       $condition = '[' . $this->settings['plural_condition'] . ']';
-      $count = (int) token_replace($condition, $data);
+      $count = (int) token_replace($condition, 'facetapi_results', $adapter);
       if ($count != 1) {
         $raw_text = $this->settings['text_plural'];
         $translation_key = 'text_plural';
@@ -37,7 +37,7 @@ class CurrentSearchItemText extends CurrentSearchItem {
     // Translates text, returns themed output.
     $translated_text = $this->translate($translation_key, $raw_text);
     $variables = array(
-      'text' => filter_xss_admin(token_replace($translated_text, $data)),
+      'text' => filter_xss_admin(token_replace($translated_text, 'facetapi_results', $adapter)),
       'wrapper' => $this->settings['wrapper'],
       'element' => $this->settings['element'],
       'css' => $this->settings['css'],
diff --git a/contrib/current_search/plugins/export_ui/current_search_export_ui.class.php b/contrib/current_search/plugins/export_ui/current_search_export_ui.class.php
index 177982e..10bbb02 100644
--- a/contrib/current_search/plugins/export_ui/current_search_export_ui.class.php
+++ b/contrib/current_search/plugins/export_ui/current_search_export_ui.class.php
@@ -167,9 +167,8 @@ function current_search_settings_form(&$form, &$form_state) {
 
   // NOTE: We need to add the #id in order for the machine_name to work.
   $form['info']['label'] = array(
-    '#id' => 'edit-label',
-    '#title' => t('Name'),
     '#type' => 'textfield',
+    '#title' => t('Name'),
     '#default_value' => $item->label,
     '#description' => t('The human-readable name of the current search block configuration.'),
     '#required' => TRUE,
@@ -178,14 +177,10 @@ function current_search_settings_form(&$form, &$form_state) {
   );
 
   $form['info']['name'] = array(
-    '#type' => 'machine_name',
+    '#type' => 'textfield',
+    '#title' => t('Machine name'),
     '#default_value' => $item->name,
     '#maxlength' => 32,
-    '#machine_name' => array(
-      'exists' => 'current_search_config_exists',
-      'source' => array('info', 'label'),
-    ),
-    '#disabled' => !empty($item->name),
     '#description' => t('The machine readable name of the current search block configuration. This value can only contain letters, numbers, and underscores.'),
   );
 
@@ -203,8 +198,8 @@ function current_search_settings_form(&$form, &$form_state) {
 
   // Add our custom buttons.
   $form['actions'] = array(
-    '#type' => 'actions',
-    '#weight' => -100,
+    '#type' => 'fieldset',
+    '#weight' => 100,
   );
 
   // Gets destination from query string which is set when the page is navigated
@@ -232,14 +227,16 @@ function current_search_settings_form(&$form, &$form_state) {
     '#value' => $submit_text,
   );
 
+  $cancel_options = array('title' => $cancel_title);
+  if ($url) {
+    $cancel_options += array('query' => $url['query']);
+  }
+
   $form['actions']['cancel'] = array(
-    '#type' => 'link',
-    '#title' => t('Cancel'),
-    '#href' => (!$url) ? 'admin/settings/current_search' : $url['path'],
-    '#options' => (!$url) ? array() : array('query' => $url['query']),
-    '#attributes' => array('title' => $cancel_title),
+    '#value' => l('Cancel', (!$url) ? 'admin/settings/current_search' : $url['path'], $cancel_options),
   );
 
+
   if (empty($item->name)) {
     $description = t('Add a new current search block configuration.');
   }
@@ -300,13 +297,10 @@ function current_search_settings_form(&$form, &$form_state) {
   );
 
   $form['plugins']['item_name'] = array(
-    '#type' => 'machine_name',
+    '#type' => 'textfield',
+    '#title' => t('Machine name'),
     '#default_value' => '',
     '#maxlength' => 32,
-    '#machine_name' => array(
-      'exists' => 'current_search_item_exists',
-      'source' => array('plugins', 'item_label'),
-    ),
     '#required' => FALSE,
     '#description' => t('The machine readable name of the item being added to the current search block. This value can only contain letters, numbers, and underscores.'),
   );
@@ -345,9 +339,7 @@ function current_search_settings_form(&$form, &$form_state) {
       '#value' => check_plain($settings['label']),
     );
     $form['plugin_sort'][$name]['remove'] = array(
-      '#type' => 'link',
-      '#title' => t('Remove item'),
-      '#href' => 'admin/settings/current_search/item/' . $item->name . '/delete/' . $name,
+      '#value' => l('Remove item', 'admin/settings/current_search/item/' . $item->name . '/delete/' . $name),
     );
     $form['plugin_sort'][$name]['weight'] = array(
       '#type' => 'weight',
@@ -372,7 +364,7 @@ function current_search_settings_form(&$form, &$form_state) {
   );
 
   $form['plugin_settings'] = array(
-    '#type' => 'vertical_tabs',
+    '#type' => 'fieldset',
     '#tree' => TRUE,
   );
 
@@ -380,12 +372,14 @@ function current_search_settings_form(&$form, &$form_state) {
   $has_settings = FALSE;
   foreach ($item->settings['items'] as $name => $settings) {
     if ($class = ctools_plugin_load_class('current_search', 'items', $settings['id'], 'handler')) {
+
       $plugin = new $class($name, $item);
 
       // Initializes vertical tab for the item's settings.
       $form['plugin_settings'][$name] = array(
         '#type' => 'fieldset',
         '#title' => check_plain($settings['label']),
+        '#collapsible' => TRUE,
         '#group' => 'settings',
         '#tree' => TRUE,
       );
@@ -444,7 +438,6 @@ function current_search_settings_form(&$form, &$form_state) {
     '#default_value' => $item->settings['advanced']['empty_searches'],
     '#description' => t('This setting determines when the current search block will be displayed.'),
   );
-
 }
 
 /**
@@ -589,10 +582,7 @@ function current_search_delete_item_form(&$form_state, stdClass $item, $name) {
   );
 
   $form['actions']['cancel'] = array(
-    '#type' => 'link',
-    '#title' => t('Cancel'),
-    '#href' => 'admin/settings/current_search/list/' . $item->name . '/edit',
-    '#attributes' => array('title' => t('Go back to current search block configuration')),
+    '#value' => l('Cancel', 'admin/settings/current_search/list/' . $item->name . '/edit', array('title' => t('Go back to current search block configuration')) ),
   );
 
   $form['#submit'][] = 'current_search_delete_item_form_submit';
