diff --git a/hierarchical_select.module b/hierarchical_select.module
index 02b2797..d75a0d9 100644
--- a/hierarchical_select.module
+++ b/hierarchical_select.module
@@ -274,65 +274,28 @@ function hierarchical_select_config_id_load($config_id) {
 // Forms API callbacks.
 
 /**
- * Strongly 
+ * Ajax callback to render the select form elements.
  *
  * @see file_ajax_upload(), upon which this is strongly inspired.
  * @see ajax_form_callback()
  */
-function hierarchical_select_ajax($form, $form_state) {
+function hierarchical_select_ajax() {
   $form_parents = func_get_args();
-  $form_build_id = (string) array_pop($form_parents);
-
-  if (empty($_POST['form_build_id']) || $form_build_id != $_POST['form_build_id']) {
-    // Invalid request.
-    drupal_set_message(t('An unrecoverable error occurred.'), 'error');
-    $commands = array();
-    $commands[] = ajax_command_replace(NULL, theme('status_messages'));
-    return array('#type' => 'ajax', '#commands' => $commands);
-  }
-
-  list($form, $form_state) = ajax_get_form();
-
-  if (!$form) {
-    // Invalid form_build_id.
-    drupal_set_message(t('An unrecoverable error occurred. Use of this form has expired. Try reloading the page and submitting again.'), 'error');
-    $commands = array();
-    $commands[] = ajax_command_replace(NULL, theme('status_messages'));
-    return array('#type' => 'ajax', '#commands' => $commands);
-  }
+  list($form, $form_state, $form_id, $form_build_id, $commands) = ajax_get_form();
 
   // Process user input. $form and $form_state are modified in the process.
   drupal_process_form($form['#form_id'], $form, $form_state);
-
-  // Retrieve the element to be rendered.
-  foreach ($form_parents as $parent) {
-    $form = $form[$parent];
-  }
-  
-  // If the user's browser supports the active cache system, then send the
-  // currently requested hierarchy in an easy-to-manage form.
-  $cache = array();
-  if (isset($_POST['client_supports_caching'])) {
-    if ($_POST['client_supports_caching'] == 'true') {
-      $cache = _hierarchical_select_json_convert_hierarchy_to_cache($form['hierarchy']['#value']);
-    }
-    else if ($_POST['client_supports_caching'] == 'false') {
-      // This indicates that a client-side cache is installed, but not working
-      // properly.
-      // TODO: figure out a clean way to notify the administrator.
-    }
-  }
+  $element = drupal_array_get_nested_value($form, $form_parents);
 
   // Render the output.
-  $output = theme('status_messages') . drupal_render($form);
+  $output = theme('status_messages') . drupal_render($element);
 
   // Send AJAX command to update the Hierarchical Select.
-  $commands = array();
   $commands[] = array(
-      'command' => 'hierarchicalSelectUpdate', 
-      'output'  => $output, 
-      // 'cache'   => $cache,
+    'command' => 'hierarchicalSelectUpdate',
+    'output'  => $output,
   );
+
   $new_settings = _hs_new_setting_ajax(FALSE);
   foreach ($new_settings as $new_setting) {
     $commands[] = array(
@@ -341,6 +304,7 @@ function hierarchical_select_ajax($form, $form_state) {
       'settings' => $new_setting['settings'],
     );
   }
+
   return array('#type' => 'ajax', '#commands' => $commands);
 }
 
@@ -408,7 +372,7 @@ function _hs_process_attach_css_js($element, $hsid, &$form_state, $complete_form
              'createNewItems'   => (isset($config['editability']['status'])) ? (int) $config['editability']['status'] : 0,
              'createNewLevels'  => (isset($config['editability']['allow_new_levels'])) ? (int) $config['editability']['allow_new_levels'] : 0,
              'resizable'        => (isset($config['resizable'])) ? (int) $config['resizable'] : 0,
-             'ajax_url'         => url('hierarchical_select_ajax/' . implode('/', $element['#array_parents']) . '/' . $complete_form['form_build_id']['#value']),
+             'ajax_url'         => url('hierarchical_select_ajax/' . implode('/', $element['#array_parents'])),
           ),
          ),
        )
