diff --git a/includes/common.inc b/includes/common.inc
index da7d6402d61e724b3a0010596954f90a60b83186..1be683d2c93d77ad0871f73562ee10bada9e2876 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -1742,15 +1742,15 @@ function drupal_add_js($data = NULL, $type = 'module', $scope = 'header', $defer
  * @return
  *   All JavaScript code segments and includes for the scope as HTML tags.
  */
-function drupal_get_js($scope = 'header', $javascript = NULL) { 
+function drupal_get_js($scope = 'header', $javascript = NULL) {
   if (!isset($javascript)) {
     $javascript = drupal_add_js(NULL, NULL, $scope);
   }
 
   if (count($javascript) < 1) {
     return '';
-  }                                                    
-  
+  }
+
   $output = '';
   $preprocessed = '';
   $no_preprocess = array('core' => '', 'module' => '', 'theme' => '');
@@ -1760,7 +1760,7 @@ function drupal_get_js($scope = 'header', $javascript = NULL) {
   $is_writable = is_dir($directory) && is_writable($directory) && (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PUBLIC);
 
   foreach ($javascript as $type => $data) {
-    
+
     if (!$data) continue;
 
     switch ($type) {
@@ -1776,27 +1776,27 @@ function drupal_get_js($scope = 'header', $javascript = NULL) {
         // If JS preprocessing is off, we still need to output the scripts.
         // Additionally, go through any remaining scripts if JS preprocessing is on and output the non-cached ones.
         foreach ($data as $path => $info) {
-          if (!$info['preprocess'] || !$is_writable || !$preprocess_js) {   
+          if (!$info['preprocess'] || !$is_writable || !$preprocess_js) {
             $no_preprocess[$type] .= '<script type="text/javascript"'. ($info['defer'] ? ' defer="defer"' : '') .' src="'. base_path() . $path . ($info['cache'] ? '' : '?'. time()) ."\"></script>\n";
           }
-          else {             
+          else {
             $files[$path] = $info;
           }
         }
     }
   }
-  
+
   // Aggregate any remaining JS files that haven't already been output.
-  if ($is_writable && $preprocess_js && count($files) > 0) {     
+  if ($is_writable && $preprocess_js && count($files) > 0) {
     $filename = md5(serialize($files)) .'.js';
     $preprocess_file = drupal_build_js_cache($files, $filename);
     $preprocessed .= '<script type="text/javascript" src="'. base_path() . $preprocess_file .'"></script>'. "\n";
   }
-  
+
   // Keep the order of JS files consistent as some are preprocessed and others are not.
   // Make sure any inline or JS setting variables appear last after libraries have loaded.
   $output = $preprocessed . implode('', $no_preprocess) . $output;
-  
+
   return $output;
 }
 
@@ -1818,9 +1818,9 @@ function drupal_build_js_cache($files, $filename) {
   file_check_directory($jspath, FILE_CREATE_DIRECTORY);
 
   if (!file_exists($jspath .'/'. $filename)) {
-    // Build aggregate JS file.               
-    foreach ($files as $path => $info) {       
-      if ($info['preprocess']) {                                       
+    // Build aggregate JS file.
+    foreach ($files as $path => $info) {
+      if ($info['preprocess']) {
         // Append a ';' after each JS file to prevent them from running together.
         $contents .= _drupal_compress_js(file_get_contents($path). ';');
       }
@@ -1858,8 +1858,8 @@ function _drupal_compress_js($script) {
   $script = _packer_apply($script, $regexps, TRUE);
 
   return $script;
-}     
-  
+}
+
 /**
  * Multi-regexp replacements.
  *
@@ -1887,7 +1887,7 @@ function _packer_apply($script, $regexps, $escape = FALSE) {
 
     // Count the number of matching groups (including the whole).
     $length = 1 + preg_match_all('/(?<!\\\\)\((?!\?)/', $expression, $out);
-    
+
     // Treat only strings $replacement
     if (is_string($replacement)) {
       // Does the pattern deal with sub-expressions?
@@ -1918,9 +1918,9 @@ function _packer_apply($script, $regexps, $escape = FALSE) {
       $_regexps[] = array('/^$/', $replacement, $length);
     }
   }
-  
+
   // Execute the global replacement
-  
+
   // Build one mega-regexp out of the smaller ones.
   $regexp = '/';
   foreach ($_regexps as $_regexp) {
@@ -1928,7 +1928,7 @@ function _packer_apply($script, $regexps, $escape = FALSE) {
     $regexp .= '(' . substr($expression, 1, -1) . ')|';
   }
   $regexp = substr($regexp, 0, -1) . '/';
-  
+
   // In order to simplify the regexps that look e.g. for quoted strings, we
   // remove all escaped characters (such as \' or \") from the data. Then, we
   // put them back as they were.
@@ -1983,7 +1983,7 @@ function _packer_escape_char($match, $return = FALSE) {
     $_escaped[] = $match[1];
     return '\\';
   }
-}      
+}
 
 /**
  * Helper function for _packer_apply().
@@ -2003,12 +2003,12 @@ function _packer_replacement($arguments, $regexps = NULL, $escape = NULL) {
   if (empty($arguments)) {
     return '';
   }
-  
+
   $i = 1; $j = 0;
   // Loop through the regexps
   while (isset($_regexps[$j])) {
     list($expression, $replacement, $length) = $_regexps[$j++];
-    
+
     // Do we have a result?
     if (isset($arguments[$i]) && ($arguments[$i] != '')) {
       if (is_array($replacement) && isset($replacement['fn'])) {
@@ -2043,7 +2043,7 @@ function _packer_unescape_char($match, $escaped = NULL) {
   else {
     return '\\'. array_shift($_escaped);
   }
-}           
+}
 
 /**
  * Helper function for _packer_replacement().
diff --git a/includes/form.inc b/includes/form.inc
index 01b95e0b4a4633c2bc9cb5d99826d7350e1c7d3e..81ee1ea16e29bf8fbe9881ba4ccffee29969fba0 100644
--- a/includes/form.inc
+++ b/includes/form.inc
@@ -75,6 +75,10 @@ function drupal_get_form($form_id) {
     // to build it from scratch.
     if (!isset($form)) {
       $form_state['post'] = $_POST;
+      array_shift($args);
+      array_unshift($args, $form_state);
+      array_unshift($args, $form_id);
+
       $form = call_user_func_array('drupal_retrieve_form', $args);
       $form_build_id = 'form-'. md5(mt_rand());
       $form['#build_id'] = $form_build_id;
@@ -109,7 +113,9 @@ function drupal_get_form($form_id) {
   // other variables passed into drupal_get_form().
 
   if (!empty($form_state['rebuild']) || !empty($form_state['storage'])) {
-    $args[] = $form_state;
+    array_shift($args);
+    array_unshift($args, $form_state);
+    array_unshift($args, $form_id);
     $form = call_user_func_array('drupal_retrieve_form', $args);
 
     // We need a new build_id for the new version of the form.
@@ -182,8 +188,7 @@ function drupal_execute($form_id, &$form_state) {
   // the $form_state to be the last parameter, while drupal_execute()
   // always takes it in as the second parameter.
   $args = array_slice($args, 3);
-  array_unshift($args, $form_id);
-  $args[] = $form_state;
+  $args[1] = $form_state;
 
   $form = call_user_func_array('drupal_retrieve_form', $args);
   $form['#post'] = $form_state['values'];
@@ -200,10 +205,12 @@ function drupal_execute($form_id, &$form_state) {
  *   Modules that need to generate the same form (or very similar forms)
  *   using different $form_ids can implement hook_forms(), which maps
  *   different $form_id values to the proper form constructor function.
+ * @param $form_state
+ *   A keyed array containing the current state of the form.
  * @param ...
  *   Any additional arguments needed by the form constructor function.
  */
-function drupal_retrieve_form($form_id) {
+function drupal_retrieve_form($form_id, &$form_state) {
   static $forms;
 
   // We save two copies of the incoming arguments: one for modules to use
@@ -214,6 +221,9 @@ function drupal_retrieve_form($form_id) {
   $args = func_get_args();
   $saved_args = $args;
   array_shift($args);
+  if (isset($form_state)) {
+    array_shift($args);
+  }
 
   // We first check to see if there's a function named after the $form_id.
   // If there is, we simply pass the arguments on to it to get the form.
@@ -240,6 +250,9 @@ function drupal_retrieve_form($form_id) {
       $callback = $form_definition['callback'];
     }
   }
+
+  array_unshift($args, $form_state);
+
   // If $callback was returned by a hook_forms() implementation, call it.
   // Otherwise, call the function named after the form id.
   $form = call_user_func_array(isset($callback) ? $callback : $form_id, $args);
@@ -613,7 +626,7 @@ function form_execute_handlers($type, &$form, &$form_state) {
         $batch['sets'][] = array('form_submit' => $function);
       }
       else {
-        $function($form, $form_state, $form_state['values']);
+        $function($form, $form_state);
       }
       $return = TRUE;
     }
@@ -742,7 +755,7 @@ function form_builder($form_id, $form, &$form_state) {
   // after normal input parsing has been completed.
   if (isset($form['#after_build']) && !isset($form['#after_build_done'])) {
     foreach ($form['#after_build'] as $function) {
-      $form = $function($form, $form_state['values'], $form_state);
+      $form = $function($form, $form_state);
       $form['#after_build_done'] = TRUE;
     }
   }
@@ -918,7 +931,7 @@ function _form_builder_ie_cleanup($form, &$form_state) {
  *
  * Specifically, if $form['#parents'] is array('foo', 'bar')
  * and $value is 'baz' then this function will make
- * $form_values['foo']['bar'] to be 'baz'.
+ * $form_state['values']['foo']['bar'] to be 'baz'.
  *
  * @param $form
  *   The form item. Keys used: #parents, #value
@@ -933,7 +946,7 @@ function form_set_value($form, $value, &$form_state) {
  * Helper function for form_set_value().
  *
  * We iterate over $parents and create nested arrays for them
- * in $form_values if needed. Then we insert the value into
+ * in $form_state['values'] if needed. Then we insert the value into
  * the right array.
  */
 function _form_set_value(&$form_values, $form, $parents, $value) {
diff --git a/includes/locale.inc b/includes/locale.inc
index c067e1068867ae25860f3e73c8f42c89ab92a396..0e20c1683caf85b41f6f553831458805eee36198 100644
--- a/includes/locale.inc
+++ b/includes/locale.inc
@@ -81,27 +81,27 @@ function theme_locale_languages_overview_form($form) {
 /**
  * Process language overview form submissions, updating existing languages.
  */
-function locale_languages_overview_form_submit($form, &$form_state, $form_values) {
+function locale_languages_overview_form_submit($form, &$form_state) {
   $languages = language_list();
   $enabled_count = 0;
   foreach ($languages as $langcode => $language) {
-    if ($form_values['site_default'] == $langcode) {
+    if ($form_state['values']['site_default'] == $langcode) {
       // Automatically enable the default language.
-      $form_values['enabled'][$langcode] = 1;
+      $form_state['values']['enabled'][$langcode] = 1;
     }
-    if ($form_values['enabled'][$langcode]) {
+    if ($form_state['values']['enabled'][$langcode]) {
       $enabled_count++;
       $language->enabled = 1;
     }
     else {
       $language->enabled = 0;
     }
-    $language->weight = $form_values['weight'][$langcode];
+    $language->weight = $form_state['values']['weight'][$langcode];
     db_query("UPDATE {languages} SET enabled = %d, weight = %d WHERE language = '%s'", $language->enabled, $language->weight, $langcode);
     $languages[$langcode] = $language;
   }
   drupal_set_message(t('Configuration saved.'));
-  variable_set('language_default', $languages[$form_values['site_default']]);
+  variable_set('language_default', $languages[$form_state['values']['site_default']]);
   variable_set('language_count', $enabled_count);
 
   // Changing the language settings impacts the interface.
@@ -175,7 +175,7 @@ function locale_languages_custom_form() {
  * @param $langcode
  *   Language code of the language to edit.
  */
-function locale_languages_edit_form($langcode) {
+function locale_languages_edit_form(&$form_state, $langcode) {
   if ($language = db_fetch_object(db_query("SELECT * FROM {languages} WHERE language = '%s'", $langcode))) {
     $form = array();
     _locale_languages_common_controls($form, $language);
@@ -265,14 +265,14 @@ function _locale_languages_common_controls(&$form, $language = NULL) {
 /**
  * Validate the language addition form.
  */
-function locale_languages_predefined_form_validate($form, &$form_state, $form_values) {
-  $langcode = $form_values['langcode'];
+function locale_languages_predefined_form_validate($form, &$form_state) {
+  $langcode = $form_state['values']['langcode'];
 
   if ($duplicate = db_num_rows(db_query("SELECT language FROM {languages} WHERE language = '%s'", $langcode)) != 0) {
-    form_set_error('langcode', t('The language %language (%code) already exists.', array('%language' => $form_values['name'], '%code' => $langcode)));
+    form_set_error('langcode', t('The language %language (%code) already exists.', array('%language' => $form_state['values']['name'], '%code' => $langcode)));
   }
 
-  if (!isset($form_values['name'])) {
+  if (!isset($form_state['values']['name'])) {
     // Predefined language selection.
     $predefined = _locale_get_predefined_list();
     if (!isset($predefined[$langcode])) {
@@ -281,19 +281,19 @@ function locale_languages_predefined_form_validate($form, &$form_state, $form_va
   }
   else {
     // Reuse the editing form validation routine if we add a custom language.
-    locale_languages_edit_form_validate($form_values, $form, $form_state);
+    locale_languages_edit_form_validate($form_state['values'], $form, $form_state);
   }
 }
 
 /**
  * Process the language addition form submission.
  */
-function locale_languages_predefined_form_submit($form, &$form_state, $form_values) {
-  $langcode = $form_values['langcode'];
-  if (isset($form_values['name'])) {
+function locale_languages_predefined_form_submit($form, &$form_state) {
+  $langcode = $form_state['values']['langcode'];
+  if (isset($form_state['values']['name'])) {
     // Custom language form.
-    locale_add_language($langcode, $form_values['name'], $form_values['native'], $form_values['direction'], $form_values['domain'], $form_values['prefix']);
-    drupal_set_message(t('The language %language has been created and can now be used. More information is available on the <a href="@locale-help">help screen</a>.', array('%language' => t($form_values['name']), '@locale-help' => url('admin/help/locale'))));
+    locale_add_language($langcode, $form_state['values']['name'], $form_state['values']['native'], $form_state['values']['direction'], $form_state['values']['domain'], $form_state['values']['prefix']);
+    drupal_set_message(t('The language %language has been created and can now be used. More information is available on the <a href="@locale-help">help screen</a>.', array('%language' => t($form_state['values']['name']), '@locale-help' => url('admin/help/locale'))));
   }
   else {
     // Predefined language selection.
@@ -315,31 +315,31 @@ function locale_languages_predefined_form_submit($form, &$form_state, $form_valu
 /**
  * Validate the language editing form. Reused for custom language addition too.
  */
-function locale_languages_edit_form_validate($form, &$form_state, $form_values) {
-  if (!empty($form_values['domain']) && !empty($form_values['prefix'])) {
+function locale_languages_edit_form_validate($form, &$form_state) {
+  if (!empty($form_state['values']['domain']) && !empty($form_state['values']['prefix'])) {
     form_set_error('prefix', t('Domain and path prefix values should not be set at the same time.'));
   }
-  if (!empty($form_values['domain']) && $duplicate = db_fetch_object(db_query("SELECT language FROM {languages} WHERE domain = '%s' AND language != '%s'", $form_values['domain'], $form_values['langcode']))) {
-    form_set_error('domain', t('The domain (%domain) is already tied to a language (%language).', array('%domain' => $form_values['domain'], '%language' => $duplicate->language)));
+  if (!empty($form_state['values']['domain']) && $duplicate = db_fetch_object(db_query("SELECT language FROM {languages} WHERE domain = '%s' AND language != '%s'", $form_state['values']['domain'], $form_state['values']['langcode']))) {
+    form_set_error('domain', t('The domain (%domain) is already tied to a language (%language).', array('%domain' => $form_state['values']['domain'], '%language' => $duplicate->language)));
   }
-  if (empty($form_values['prefix']) && language_default('language') != $form_values['langcode'] && empty($form_values['domain'])) {
+  if (empty($form_state['values']['prefix']) && language_default('language') != $form_state['values']['langcode'] && empty($form_state['values']['domain'])) {
     form_set_error('prefix', t('Only the default language can have both the domain and prefix empty.'));
   }
-  if (!empty($form_values['prefix']) && $duplicate = db_fetch_object(db_query("SELECT language FROM {languages} WHERE prefix = '%s' AND language != '%s'", $form_values['prefix'], $form_values['langcode']))) {
-    form_set_error('prefix', t('The prefix (%prefix) is already tied to a language (%language).', array('%prefix' => $form_values['prefix'], '%language' => $duplicate->language)));
+  if (!empty($form_state['values']['prefix']) && $duplicate = db_fetch_object(db_query("SELECT language FROM {languages} WHERE prefix = '%s' AND language != '%s'", $form_state['values']['prefix'], $form_state['values']['langcode']))) {
+    form_set_error('prefix', t('The prefix (%prefix) is already tied to a language (%language).', array('%prefix' => $form_state['values']['prefix'], '%language' => $duplicate->language)));
   }
 }
 
 /**
  * Process the language editing form submission.
  */
-function locale_languages_edit_form_submit($form, &$form_state, $form_values) {
-  db_query("UPDATE {languages} SET name = '%s', native = '%s', domain = '%s', prefix = '%s', direction = %d WHERE language = '%s'", $form_values['name'], $form_values['native'], $form_values['domain'], $form_values['prefix'], $form_values['direction'], $form_values['langcode']);
+function locale_languages_edit_form_submit($form, &$form_state) {
+  db_query("UPDATE {languages} SET name = '%s', native = '%s', domain = '%s', prefix = '%s', direction = %d WHERE language = '%s'", $form_state['values']['name'], $form_state['values']['native'], $form_state['values']['domain'], $form_state['values']['prefix'], $form_state['values']['direction'], $form_state['values']['langcode']);
   $default = language_default();
-  if ($default->language == $form_values['langcode']) {
+  if ($default->language == $form_state['values']['langcode']) {
     $properties = array('name', 'native', 'direction', 'enabled', 'plurals', 'formula', 'domain', 'prefix', 'weight');
     foreach ($properties as $keyname) {
-      $default->$keyname = $form_values[$keyname];
+      $default->$keyname = $form_state['values'][$keyname];
     }
     variable_set('language_default', $default);
   }
@@ -358,7 +358,7 @@ function locale_languages_edit_form_submit($form, &$form_state, $form_values) {
 /**
  * User interface for the language deletion confirmation screen.
  */
-function locale_languages_delete_form($langcode) {
+function locale_languages_delete_form(&$form_state, $langcode) {
 
   // Do not allow deletion of English locale.
   if ($langcode == 'en') {
@@ -386,13 +386,13 @@ function locale_languages_delete_form($langcode) {
 /**
  * Process language deletion submissions.
  */
-function locale_languages_delete_form_submit($form, &$form_state, $form_values) {
+function locale_languages_delete_form_submit($form, &$form_state) {
   $languages = language_list();
-  if (isset($languages[$form_values['langcode']])) {
-    db_query("DELETE FROM {languages} WHERE language = '%s'", $form_values['langcode']);
-    db_query("DELETE FROM {locales_target} WHERE language = '%s'", $form_values['langcode']);
-    db_query("UPDATE {node} SET language = '' WHERE language = '%s'", $form_values['langcode']);
-    $variables = array('%locale' => $languages[$form_values['langcode']]->name);
+  if (isset($languages[$form_state['values']['langcode']])) {
+    db_query("DELETE FROM {languages} WHERE language = '%s'", $form_state['values']['langcode']);
+    db_query("DELETE FROM {locales_target} WHERE language = '%s'", $form_state['values']['langcode']);
+    db_query("UPDATE {node} SET language = '' WHERE language = '%s'", $form_state['values']['langcode']);
+    $variables = array('%locale' => $languages[$form_state['values']['langcode']]->name);
     drupal_set_message(t('The language %locale has been removed.', $variables));
     watchdog('locale', 'The language %locale has been removed.', $variables);
   }
@@ -437,8 +437,8 @@ function locale_languages_configure_form() {
 /**
  * Submit function for language negotiation settings.
  */
-function locale_languages_configure_form_submit($form, &$form_state, $form_values) {
-  variable_set('language_negotiation', $form_values['language_negotiation']);
+function locale_languages_configure_form_submit($form, &$form_state) {
+  variable_set('language_negotiation', $form_state['values']['language_negotiation']);
   drupal_set_message(t('Language negotiation configuration saved.'));
   $form_state['redirect'] = 'admin/settings/language';
   return;
@@ -610,13 +610,13 @@ function locale_translate_import_form() {
 /**
  * Process the locale import form submission.
  */
-function locale_translate_import_form_submit($form, &$form_state, $form_values) {
+function locale_translate_import_form_submit($form, &$form_state) {
   // Ensure we have the file uploaded
   if ($file = file_save_upload('file')) {
 
     // Add language, if not yet supported
     $languages = language_list('language', TRUE);
-    $langcode = $form_values['langcode'];
+    $langcode = $form_state['values']['langcode'];
     if (!isset($languages[$langcode])) {
       $predefined = _locale_get_predefined_list();
       locale_add_language($langcode);
@@ -624,7 +624,7 @@ function locale_translate_import_form_submit($form, &$form_state, $form_values)
     }
 
     // Now import strings into the language
-    if ($ret = _locale_import_po($file, $langcode, $form_values['mode'], $form_values['group']) == FALSE) {
+    if ($ret = _locale_import_po($file, $langcode, $form_state['values']['mode'], $form_state['values']['group']) == FALSE) {
       $variables = array('%filename' => $file->filename);
       drupal_set_message(t('The translation import of %filename failed.', $variables), 'error');
       watchdog('locale', 'The translation import of %filename failed.', $variables, WATCHDOG_ERROR);
@@ -669,7 +669,7 @@ function locale_translate_export_screen() {
  * @param $names
  *   An associate array with localized language names
  */
-function locale_translate_export_po_form($names) {
+function locale_translate_export_po_form(&$form_state, $names) {
   $form['export'] = array('#type' => 'fieldset',
     '#title' => t('Export translation'),
     '#collapsible' => TRUE,
@@ -713,9 +713,9 @@ function locale_translate_export_pot_form() {
 /**
  * Process a translation (or template) export form submission.
  */
-function locale_translate_export_po_form_submit($form, &$form_state, $form_values) {
+function locale_translate_export_po_form_submit($form, &$form_state) {
   // If template is required, language code is not given.
-  _locale_export_po(isset($form_values['langcode']) ? $form_values['langcode'] : NULL, $form_values['group']);
+  _locale_export_po(isset($form_state['values']['langcode']) ? $form_state['values']['langcode'] : NULL, $form_state['values']['group']);
 }
 /**
  * @} End of "locale-translate-export"
@@ -729,7 +729,7 @@ function locale_translate_export_po_form_submit($form, &$form_state, $form_value
 /**
  * User interface for string editing.
  */
-function locale_translate_edit_form($lid) {
+function locale_translate_edit_form(&$form_state, $lid) {
   $languages = language_list();
   unset($languages['en']);
 
@@ -782,9 +782,9 @@ function locale_translate_edit_form($lid) {
  * Process string editing form submissions.
  * Saves all translations of one string submitted from a form.
  */
-function locale_translate_edit_form_submit($form, &$form_state, $form_values) {
-  $lid = $form_values['lid'];
-  foreach ($form_values['translations'] as $key => $value) {
+function locale_translate_edit_form_submit($form, &$form_state) {
+  $lid = $form_state['values']['lid'];
+  foreach ($form_state['values']['translations'] as $key => $value) {
     $trans = db_fetch_object(db_query("SELECT translation FROM {locales_target} WHERE lid = %d AND language = '%s'", $lid, $key));
     if (isset($trans->translation)) {
       db_query("UPDATE {locales_target} SET translation = '%s' WHERE lid = %d AND language = '%s'", $value, $lid, $key);
diff --git a/install.php b/install.php
index 987bfd3ab9ff6640671cb192369a68b9157c5856..2628ed38f93578a1d73fdeb9a224fa19399fd7af 100644
--- a/install.php
+++ b/install.php
@@ -208,7 +208,7 @@ function install_change_settings($profile = 'default', $install_locale = '') {
 /**
  * Form API array definition for install_settings.
  */
-function install_settings_form($profile, $install_locale, $settings_file, $db_url, $db_type, $db_prefix, $db_user, $db_pass, $db_host, $db_port, $db_path) {
+function install_settings_form(&$form_state, $profile, $install_locale, $settings_file, $db_url, $db_type, $db_prefix, $db_user, $db_pass, $db_host, $db_port, $db_path) {
   if (empty($db_host)) {
     $db_host = 'localhost';
   }
@@ -335,9 +335,9 @@ function install_settings_form($profile, $install_locale, $settings_file, $db_ur
 /**
  * Form API validate for install_settings form.
  */
-function install_settings_form_validate($form, &$form_state, $form_values) {
+function install_settings_form_validate($form, &$form_state) {
   global $db_url;
-  _install_settings_form_validate($form_values['db_prefix'], $form_values['db_type'], $form_values['db_user'], $form_values['db_pass'], $form_values['db_host'], $form_values['db_port'], $form_values['db_path'], $form_values['settings_file'], $form_state, $form);
+  _install_settings_form_validate($form_state['values']['db_prefix'], $form_state['values']['db_type'], $form_state['values']['db_user'], $form_state['values']['db_pass'], $form_state['values']['db_host'], $form_state['values']['db_port'], $form_state['values']['db_path'], $form_state['values']['settings_file'], $form_state, $form);
 }
 
 /**
@@ -387,16 +387,16 @@ function _install_settings_form_validate($db_prefix, $db_type, $db_user, $db_pas
 /**
  * Form API submit for install_settings form.
  */
-function install_settings_form_submit($form, &$form_state, $form_values) {
+function install_settings_form_submit($form, &$form_state) {
   global $profile, $install_locale;
 
   // Update global settings array and save
   $settings['db_url'] = array(
-    'value'    => $form_values['_db_url'],
+    'value'    => $form_state['values']['_db_url'],
     'required' => TRUE,
   );
   $settings['db_prefix'] = array(
-    'value'    => $form_values['db_prefix'],
+    'value'    => $form_state['values']['db_prefix'],
     'required' => TRUE,
   );
   drupal_rewrite_settings($settings);
@@ -444,7 +444,7 @@ function install_select_profile() {
   }
 }
 
-function install_select_profile_form($profiles) {
+function install_select_profile_form(&$form_state, $profiles) {
   foreach ($profiles as $profile) {
     include_once($profile->filename);
     // Load profile details.
@@ -531,7 +531,7 @@ function install_select_locale($profilename) {
   }
 }
 
-function install_select_locale_form($locales) {
+function install_select_locale_form(&$form_state, $locales) {
   include_once './includes/locale.inc';
   $languages = _locale_get_predefined_list();
   foreach ($locales as $locale) {
@@ -622,7 +622,7 @@ function install_tasks($profile, $task) {
 
     $form_state = array('storage' => NULL, 'submitted' => FALSE);
 
-    $form = drupal_retrieve_form('install_configure_form');
+    $form = drupal_retrieve_form('install_configure_form', $form_state);
     $form_build_id = md5(mt_rand());
     $form['#build_id'] = $form_build_id;
     drupal_prepare_form('install_configure_form', $form, $form_state);
@@ -926,36 +926,42 @@ function install_configure_form() {
   return $form;
 }
 
-function install_configure_form_validate($form, &$form_state, $form_values) {
-  if ($error = user_validate_name($form_values['account']['name'])) {
+function install_configure_form_validate($form, &$form_state) {
+  if ($error = user_validate_name($form_state['values']['account']['name'])) {
     form_error($form['admin_account']['account']['name'], $error);
   }
-  if ($error = user_validate_mail($form_values['account']['mail'])) {
+  if ($error = user_validate_mail($form_state['values']['account']['mail'])) {
     form_error($form['admin_account']['account']['mail'], $error);
   }
-  if ($error = user_validate_mail($form_values['site_mail'])) {
+  if ($error = user_validate_mail($form_state['values']['site_mail'])) {
     form_error($form['site_information']['site_mail'], $error);
   }
 }
 
-function install_configure_form_submit($form, &$form_state, $form_values) {
+function install_configure_form_submit($form, &$form_state) {
   global $user;
 
-  variable_set('site_name', $form_values['site_name']);
-  variable_set('site_mail', $form_values['site_mail']);
-  variable_set('date_default_timezone', $form_values['date_default_timezone']);
+  variable_set('site_name', $form_state['values']['site_name']);
+  variable_set('site_mail', $form_state['values']['site_mail']);
+  variable_set('date_default_timezone', $form_state['values']['date_default_timezone']);
+
   // Turn this off temporarily so that we can pass a password through.
   variable_set('user_email_verification', FALSE);
-  user_register_submit($form, $form_state, $form_values['account']);
+  $form_state['old_values'] = $form_state['values'];
+  $form_state['values'] = $form_state['values']['account'];
+  user_register_submit($form, $form_state);
+  $form_state['values'] = $form_state['old_values'];
+  unset($form_state['old_values']);
   variable_set('user_email_verification', TRUE);
-  if (isset($form_values['clean_url'])) {
-    variable_set('clean_url', $form_values['clean_url']);
+
+  if (isset($form_state['values']['clean_url'])) {
+    variable_set('clean_url', $form_state['values']['clean_url']);
   }
   // The user is now logged in, but has no session ID yet, which
   // would be required later in the request, so remember it.
   $user->sid = session_id();
 
-  return 'finished';
+  $form_state['redirect'] = 'finished';
 }
 
 install_main();
diff --git a/misc/drupal.js b/misc/drupal.js
index 8d46fea5863a6f93c16299e94c96acebef7673c6..dc527240dcc1833252ef1afda214f7440e3530fd 100644
--- a/misc/drupal.js
+++ b/misc/drupal.js
@@ -50,7 +50,7 @@ Drupal.redirectFormButton = function (uri, button, handler) {
         // Restore form submission
         button.form.action = action;
         button.form.target = target;
-      
+
         // Get response from iframe body
         try {
           response = (iframe.contentWindow || iframe.contentDocument || iframe).document.body.innerHTML;
@@ -64,7 +64,7 @@ Drupal.redirectFormButton = function (uri, button, handler) {
         catch (e) {
           response = null;
         }
- 
+
         response = Drupal.parseJson(response);
         // Check response code
         if (response.status == 0) {
diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module
index 9fe24073439c4677c7b92cbf9bc7e0088169a069..9e11a668de017384ff4e6b9c44c92a46a03834b6 100644
--- a/modules/aggregator/aggregator.module
+++ b/modules/aggregator/aggregator.module
@@ -357,17 +357,17 @@ function aggregator_form_category($edit = array('title' => '', 'description' =>
 /**
  * Validate aggregator_form_feed form submissions.
  */
-function aggregator_form_category_validate($form, &$form_state, $form_values) {
-  if ($form_values['op'] == t('Submit')) {
+function aggregator_form_category_validate($form, &$form_state) {
+  if ($form_state['values']['op'] == t('Submit')) {
     // Check for duplicate titles
-    if (isset($form_values['cid'])) {
-      $category = db_fetch_object(db_query("SELECT cid FROM {aggregator_category} WHERE title = '%s' AND cid != %d", $form_values['title'], $form_values['cid']));
+    if (isset($form_state['values']['cid'])) {
+      $category = db_fetch_object(db_query("SELECT cid FROM {aggregator_category} WHERE title = '%s' AND cid != %d", $form_state['values']['title'], $form_state['values']['cid']));
     }
     else {
-      $category = db_fetch_object(db_query("SELECT cid FROM {aggregator_category} WHERE title = '%s'", $form_values['title']));
+      $category = db_fetch_object(db_query("SELECT cid FROM {aggregator_category} WHERE title = '%s'", $form_state['values']['title']));
     }
     if ($category) {
-      form_set_error('title', t('A category named %category already exists. Please enter a unique title.', array('%category' => $form_values['title'])));
+      form_set_error('title', t('A category named %category already exists. Please enter a unique title.', array('%category' => $form_state['values']['title'])));
     }
   }
 }
@@ -376,23 +376,23 @@ function aggregator_form_category_validate($form, &$form_state, $form_values) {
  * Process aggregator_form_category form submissions.
  * @todo Add delete confirmation dialog.
  */
-function aggregator_form_category_submit($form, &$form_state, $form_values) {
-  if ($form_values['op'] == t('Delete')) {
-    $title = $form_values['title'];
+function aggregator_form_category_submit($form, &$form_state) {
+  if ($form_state['values']['op'] == t('Delete')) {
+    $title = $form_state['values']['title'];
     // Unset the title:
-    unset($form_values['title']);
+    unset($form_state['values']['title']);
   }
-  aggregator_save_category($form_values);
+  aggregator_save_category($form_state['values']);
   menu_rebuild();
-  if (isset($form_values['cid'])) {
-    if (isset($form_values['title'])) {
-      drupal_set_message(t('The category %category has been updated.', array('%category' => $form_values['title'])));
+  if (isset($form_state['values']['cid'])) {
+    if (isset($form_state['values']['title'])) {
+      drupal_set_message(t('The category %category has been updated.', array('%category' => $form_state['values']['title'])));
       if (arg(0) == 'admin') {
         $form_state['redirect'] = 'admin/content/aggregator/';
         return;
       }
       else {
-        $form_state['redirect'] = 'aggregator/categories/'. $form_values['cid'];
+        $form_state['redirect'] = 'aggregator/categories/'. $form_state['values']['cid'];
         return;
       }
     }
@@ -410,8 +410,8 @@ function aggregator_form_category_submit($form, &$form_state, $form_values) {
     }
   }
   else {
-    watchdog('aggregator', 'Category %category added.', array('%category' => $form_values['title']), WATCHDOG_NOTICE, l(t('view'), 'admin/content/aggregator'));
-    drupal_set_message(t('The category %category has been added.', array('%category' => $form_values['title'])));
+    watchdog('aggregator', 'Category %category added.', array('%category' => $form_state['values']['title']), WATCHDOG_NOTICE, l(t('view'), 'admin/content/aggregator'));
+    drupal_set_message(t('The category %category has been added.', array('%category' => $form_state['values']['title'])));
   }
 }
 
@@ -492,21 +492,21 @@ function aggregator_form_feed($edit = array('refresh' => 900, 'title' => '', 'ur
 /**
  * Validate aggregator_form_feed form submissions.
  */
-function aggregator_form_feed_validate($form, &$form_state, $form_values) {
-  if ($form_values['op'] == t('Submit')) {
+function aggregator_form_feed_validate($form, &$form_state) {
+  if ($form_state['values']['op'] == t('Submit')) {
     // Check for duplicate titles
-    if (isset($form_values['fid'])) {
-      $result = db_query("SELECT title, url FROM {aggregator_feed} WHERE (title = '%s' OR url='%s') AND fid != %d", $form_values['title'], $form_values['url'], $form_values['fid']);
+    if (isset($form_state['values']['fid'])) {
+      $result = db_query("SELECT title, url FROM {aggregator_feed} WHERE (title = '%s' OR url='%s') AND fid != %d", $form_state['values']['title'], $form_state['values']['url'], $form_state['values']['fid']);
     }
     else {
-      $result = db_query("SELECT title, url FROM {aggregator_feed} WHERE title = '%s' OR url='%s'", $form_values['title'], $form_values['url']);
+      $result = db_query("SELECT title, url FROM {aggregator_feed} WHERE title = '%s' OR url='%s'", $form_state['values']['title'], $form_state['values']['url']);
     }
     while ($feed = db_fetch_object($result)) {
-      if (strcasecmp($feed->title, $form_values['title']) == 0) {
-        form_set_error('title', t('A feed named %feed already exists. Please enter a unique title.', array('%feed' => $form_values['title'])));
+      if (strcasecmp($feed->title, $form_state['values']['title']) == 0) {
+        form_set_error('title', t('A feed named %feed already exists. Please enter a unique title.', array('%feed' => $form_state['values']['title'])));
       }
-      if (strcasecmp($feed->url, $form_values['url']) == 0) {
-        form_set_error('url', t('A feed with this URL %url already exists. Please enter a unique URL.', array('%url' => $form_values['url'])));
+      if (strcasecmp($feed->url, $form_state['values']['url']) == 0) {
+        form_set_error('url', t('A feed with this URL %url already exists. Please enter a unique URL.', array('%url' => $form_state['values']['url'])));
       }
     }
   }
@@ -516,23 +516,23 @@ function aggregator_form_feed_validate($form, &$form_state, $form_values) {
  * Process aggregator_form_feed form submissions.
  * @todo Add delete confirmation dialog.
  */
-function aggregator_form_feed_submit($form, &$form_state, $form_values) {
-  if ($form_values['op'] == t('Delete')) {
-    $title = $form_values['title'];
+function aggregator_form_feed_submit($form, &$form_state) {
+  if ($form_state['values']['op'] == t('Delete')) {
+    $title = $form_state['values']['title'];
     // Unset the title:
-    unset($form_values['title']);
+    unset($form_state['values']['title']);
   }
-  aggregator_save_feed($form_values);
+  aggregator_save_feed($form_state['values']);
   menu_rebuild();
-  if (isset($form_values['fid'])) {
-    if (isset($form_values['title'])) {
-      drupal_set_message(t('The feed %feed has been updated.', array('%feed' => $form_values['title'])));
+  if (isset($form_state['values']['fid'])) {
+    if (isset($form_state['values']['title'])) {
+      drupal_set_message(t('The feed %feed has been updated.', array('%feed' => $form_state['values']['title'])));
       if (arg(0) == 'admin') {
         $form_state['redirect'] = 'admin/content/aggregator/';
         return;
       }
       else {
-        $form_state['redirect'] = 'aggregator/sources/'. $form_values['fid'];
+        $form_state['redirect'] = 'aggregator/sources/'. $form_state['values']['fid'];
         return;
       }
     }
@@ -550,8 +550,8 @@ function aggregator_form_feed_submit($form, &$form_state, $form_values) {
     }
   }
   else {
-    watchdog('aggregator', 'Feed %feed added.', array('%feed' => $form_values['title']), WATCHDOG_NOTICE, l(t('view'), 'admin/content/aggregator'));
-    drupal_set_message(t('The feed %feed has been added.', array('%feed' => $form_values['title'])));
+    watchdog('aggregator', 'Feed %feed added.', array('%feed' => $form_state['values']['title']), WATCHDOG_NOTICE, l(t('view'), 'admin/content/aggregator'));
+    drupal_set_message(t('The feed %feed has been added.', array('%feed' => $form_state['values']['title'])));
   }
 }
 
@@ -1170,8 +1170,8 @@ function aggregator_page_list_validate($form_id, &$form) {
   }
 }
 
-function aggregator_page_list_submit($form, &$form_state, $form_values) {
-  foreach ($form_values['categories'] as $iid => $selection) {
+function aggregator_page_list_submit($form, &$form_state) {
+  foreach ($form_state['values']['categories'] as $iid => $selection) {
     db_query('DELETE FROM {aggregator_category_item} WHERE iid = %d', $iid);
     foreach ($selection as $cid) {
       if ($cid) {
diff --git a/modules/block/block.module b/modules/block/block.module
index f7c27c69eb477dbf67e3eadef9eaafea99a2cde5..8de8f495246b6157222856cdb9445ace37927abf 100644
--- a/modules/block/block.module
+++ b/modules/block/block.module
@@ -292,8 +292,8 @@ function _block_compare($a, $b) {
 /**
  * Process main block administration form submission.
  */
-function block_admin_display_submit($form, &$form_state, $form_values) {
-  foreach ($form_values as $block) {
+function block_admin_display_submit($form, &$form_state) {
+  foreach ($form_state['values'] as $block) {
     $block['status'] = $block['region'] != BLOCK_REGION_NONE;
     $block['region'] = $block['status'] ? $block['region'] : '';
     db_query("UPDATE {blocks} SET status = %d, weight = %d, region = '%s', throttle = %d WHERE module = '%s' AND delta = '%s' AND theme = '%s'", $block['status'], $block['weight'], $block['region'], isset($block['throttle']) ? $block['throttle'] : 0, $block['module'], $block['delta'], $block['theme']);
@@ -498,22 +498,22 @@ function block_admin_configure($module = NULL, $delta = 0) {
   return $form;
 }
 
-function block_admin_configure_validate($form, &$form_state, $form_values) {
-  if ($form_values['module'] == 'block') {
-    if (empty($form_values['info']) || db_num_rows(db_query("SELECT bid FROM {boxes} WHERE bid != %d AND info = '%s'", $form_values['delta'], $form_values['info']))) {
+function block_admin_configure_validate($form, &$form_state) {
+  if ($form_state['values']['module'] == 'block') {
+    if (empty($form_state['values']['info']) || db_num_rows(db_query("SELECT bid FROM {boxes} WHERE bid != %d AND info = '%s'", $form_state['values']['delta'], $form_state['values']['info']))) {
       form_set_error('info', t('Please ensure that each block description is unique.'));
     }
   }
 }
 
-function block_admin_configure_submit($form, &$form_state, $form_values) {
+function block_admin_configure_submit($form, &$form_state) {
   if (!form_get_errors()) {
-    db_query("UPDATE {blocks} SET visibility = %d, pages = '%s', custom = %d, title = '%s' WHERE module = '%s' AND delta = '%s'", $form_values['visibility'], trim($form_values['pages']), $form_values['custom'], $form_values['title'], $form_values['module'], $form_values['delta']);
-    db_query("DELETE FROM {blocks_roles} WHERE module = '%s' AND delta = '%s'", $form_values['module'], $form_values['delta']);
-    foreach (array_filter($form_values['roles']) as $rid) {
-      db_query("INSERT INTO {blocks_roles} (rid, module, delta) VALUES (%d, '%s', '%s')", $rid, $form_values['module'], $form_values['delta']);
+    db_query("UPDATE {blocks} SET visibility = %d, pages = '%s', custom = %d, title = '%s' WHERE module = '%s' AND delta = '%s'", $form_state['values']['visibility'], trim($form_state['values']['pages']), $form_state['values']['custom'], $form_state['values']['title'], $form_state['values']['module'], $form_state['values']['delta']);
+    db_query("DELETE FROM {blocks_roles} WHERE module = '%s' AND delta = '%s'", $form_state['values']['module'], $form_state['values']['delta']);
+    foreach (array_filter($form_state['values']['roles']) as $rid) {
+      db_query("INSERT INTO {blocks_roles} (rid, module, delta) VALUES (%d, '%s', '%s')", $rid, $form_state['values']['module'], $form_state['values']['delta']);
     }
-    module_invoke($form_values['module'], 'block', 'save', $form_values['delta'], $form_values);
+    module_invoke($form_state['values']['module'], 'block', 'save', $form_state['values']['delta'], $form_state['values']);
     drupal_set_message(t('The block configuration has been saved.'));
     cache_clear_all();
     $form_state['redirect'] = 'admin/build/block';
@@ -528,8 +528,8 @@ function block_add_block_form() {
   return block_admin_configure('block', NULL);
 }
 
-function block_add_block_form_validate($form, &$form_state, $form_values) {
-  if (empty($form_values['info']) || db_num_rows(db_query("SELECT info FROM {boxes} WHERE info = '%s'", $form_values['info']))) {
+function block_add_block_form_validate($form, &$form_state) {
+  if (empty($form_state['values']['info']) || db_num_rows(db_query("SELECT info FROM {boxes} WHERE info = '%s'", $form_state['values']['info']))) {
     form_set_error('info', t('Please ensure that each block description is unique.'));
   }
 }
@@ -537,20 +537,20 @@ function block_add_block_form_validate($form, &$form_state, $form_values) {
 /**
  * Save the new custom block.
  */
-function block_add_block_form_submit($form, &$form_state, $form_values) {
+function block_add_block_form_submit($form, &$form_state) {
   $delta = db_next_id('{boxes}_bid');
 
   foreach (list_themes() as $key => $theme) {
     if ($theme->status) {
-      db_query("INSERT INTO {blocks} (visibility, pages, custom, title, module, theme, status, weight, delta) VALUES(%d, '%s', %d, '%s', '%s', '%s', %d, %d, %d)", $form_values['visibility'], trim($form_values['pages']), $form_values['custom'], $form_values['title'], $form_values['module'], $theme->name, 0, 0, $delta);
+      db_query("INSERT INTO {blocks} (visibility, pages, custom, title, module, theme, status, weight, delta) VALUES(%d, '%s', %d, '%s', '%s', '%s', %d, %d, %d)", $form_state['values']['visibility'], trim($form_state['values']['pages']), $form_state['values']['custom'], $form_state['values']['title'], $form_state['values']['module'], $theme->name, 0, 0, $delta);
     }
   }
 
-  foreach (array_filter($form_values['roles']) as $rid) {
-    db_query("INSERT INTO {blocks_roles} (rid, module, delta) VALUES (%d, '%s', '%s')", $rid, $form_values['module'], $delta);
+  foreach (array_filter($form_state['values']['roles']) as $rid) {
+    db_query("INSERT INTO {blocks_roles} (rid, module, delta) VALUES (%d, '%s', '%s')", $rid, $form_state['values']['module'], $delta);
   }
 
-  db_query("INSERT INTO {boxes} (bid, body, info, format) VALUES  (%d, '%s', '%s', %d)", $delta, $form_values['body'], $form_values['info'], $form_values['format']);
+  db_query("INSERT INTO {boxes} (bid, body, info, format) VALUES  (%d, '%s', '%s', %d)", $delta, $form_state['values']['body'], $form_state['values']['info'], $form_state['values']['format']);
 
   drupal_set_message(t('The block has been created.'));
   cache_clear_all();
@@ -573,10 +573,10 @@ function block_box_delete($bid = 0) {
 /**
  * Deletion of custom blocks.
  */
-function block_box_delete_submit($form, &$form_state, $form_values) {
-  db_query('DELETE FROM {boxes} WHERE bid = %d', $form_values['bid']);
-  db_query("DELETE FROM {blocks} WHERE module = 'block' AND delta = %d", $form_values['bid']);
-  drupal_set_message(t('The block %name has been removed.', array('%name' => $form_values['info'])));
+function block_box_delete_submit($form, &$form_state) {
+  db_query('DELETE FROM {boxes} WHERE bid = %d', $form_state['values']['bid']);
+  db_query("DELETE FROM {blocks} WHERE module = 'block' AND delta = %d", $form_state['values']['bid']);
+  drupal_set_message(t('The block %name has been removed.', array('%name' => $form_state['values']['info'])));
   cache_clear_all();
   $form_state['redirect'] = 'admin/build/block';
   return;
diff --git a/modules/book/book.module b/modules/book/book.module
index 8dc1250b4535f1c5400d0fe60b48fea9e39b42c5..a9bacb8698f876e0068375b015003f10b7f54ace 100644
--- a/modules/book/book.module
+++ b/modules/book/book.module
@@ -260,7 +260,7 @@ function book_form(&$node) {
  * Implementation of function book_outline()
  * Handles all book outline operations.
  */
-function book_outline($node) {
+function book_outline($form_state, $node) {
   $form['parent'] = array('#type' => 'select',
     '#title' => t('Parent'),
     '#default_value' => isset($node->parent) ? $node->parent : 0,
@@ -298,19 +298,19 @@ function book_outline($node) {
 /**
  * Handles book outline form submissions.
  */
-function book_outline_submit($form, &$form_state, $form_values) {
-  $op = $form_values['op'];
-  $node = node_load($form_values['nid']);
+function book_outline_submit($form, &$form_state) {
+  $op = $form_state['values']['op'];
+  $node = node_load($form_state['values']['nid']);
 
   switch ($op) {
     case t('Add to book outline'):
-      db_query('INSERT INTO {book} (nid, vid, parent, weight) VALUES (%d, %d, %d, %d)', $node->nid, $node->vid, $form_values['parent'], $form_values['weight']);
-      db_query("UPDATE {node_revisions} SET log = '%s' WHERE vid = %d", $form_values['log'], $node->vid);
+      db_query('INSERT INTO {book} (nid, vid, parent, weight) VALUES (%d, %d, %d, %d)', $node->nid, $node->vid, $form_state['values']['parent'], $form_state['values']['weight']);
+      db_query("UPDATE {node_revisions} SET log = '%s' WHERE vid = %d", $form_state['values']['log'], $node->vid);
       drupal_set_message(t('The post has been added to the book.'));
       break;
     case t('Update book outline'):
-      db_query('UPDATE {book} SET parent = %d, weight = %d WHERE vid = %d', $form_values['parent'], $form_values['weight'], $node->vid);
-      db_query("UPDATE {node_revisions} SET log = '%s' WHERE vid = %d", $form_values['log'], $node->vid);
+      db_query('UPDATE {book} SET parent = %d, weight = %d WHERE vid = %d', $form_state['values']['parent'], $form_state['values']['weight'], $node->vid);
+      db_query("UPDATE {node_revisions} SET log = '%s' WHERE vid = %d", $form_state['values']['log'], $node->vid);
       drupal_set_message(t('The book outline has been updated.'));
       break;
     case t('Remove from book outline'):
@@ -875,7 +875,7 @@ function theme_book_admin_table($form) {
 /**
  * Display an administrative view of the hierarchy of a book.
  */
-function book_admin_edit($nid) {
+function book_admin_edit($form_state, $nid) {
   $node = node_load($nid);
   if ($node->nid) {
     drupal_set_title(check_plain($node->title));
@@ -931,8 +931,8 @@ function book_admin_orphan() {
   return $form;
 }
 
-function book_admin_edit_submit($form, &$form_state, $form_values) {
-  foreach ($form_values['table'] as $row) {
+function book_admin_edit_submit($form, &$form_state) {
+  foreach ($form_state['values']['table'] as $row) {
     $node = node_load($row['nid']);
 
     if ($row['title'] != $node->title || $row['weight'] != $node->weight) {
@@ -1004,5 +1004,3 @@ function book_help($section) {
     return '<p>'. t('The outline feature allows you to include posts in the <a href="@book">book hierarchy</a>.', array('@book' => url('book'))) .'</p>';
   }
 }
-
-
diff --git a/modules/color/color.module b/modules/color/color.module
index 027e7bd1a3f9c31c9156b42485ad54d587968743..f0866560ee0c943ce6cd9faf0a38e883c51ca347 100644
--- a/modules/color/color.module
+++ b/modules/color/color.module
@@ -25,7 +25,7 @@ function color_form_alter(&$form, $form_state, $form_id) {
       '#attributes' => array('id' => 'color_scheme_form'),
       '#theme' => 'color_scheme_form',
     );
-    $form['color'] += color_scheme_form(arg(4));
+    $form['color'] += color_scheme_form($form_state, arg(4));
     $form['#submit'][] = 'color_scheme_form_submit';
   }
 
@@ -93,7 +93,7 @@ function color_get_palette($theme, $default = false) {
 /**
  * Form callback. Returns the configuration form.
  */
-function color_scheme_form($theme) {
+function color_scheme_form(&$form_state, $theme) {
   $base = drupal_get_path('module', 'color');
   $info = color_get_info($theme);
 
@@ -183,18 +183,18 @@ function theme_color_scheme_form($form) {
 /**
  * Submit handler for color change form.
  */
-function color_scheme_form_submit($values, $form, &$form_state) {
+function color_scheme_form_submit($form, &$form_state) {
   // Get theme coloring info
-  if (!isset($values['info'])) {
+  if (!isset($form_state['values']['info'])) {
     return;
   }
-  $theme = $values['theme'];
-  $info = $values['info'];
+  $theme = $form_state['values']['theme'];
+  $info = $form_state['values']['info'];
 
   // Resolve palette
-  $palette = $values['palette'];
-  if ($values['scheme'] != '') {
-    $scheme = explode(',', $values['scheme']);
+  $palette = $form_state['values']['palette'];
+  if ($form_state['values']['scheme'] != '') {
+    $scheme = explode(',', $form_state['values']['scheme']);
     foreach ($palette as $k => $color) {
       $palette[$k] = array_shift($scheme);
     }
@@ -227,7 +227,7 @@ function color_scheme_form_submit($values, $form, &$form_state) {
 
   // Don't render the default colorscheme, use the standard theme instead.
   if (implode(',', color_get_palette($theme, true)) == implode(',', $palette)
-    || $values['op'] == t('Reset to defaults')) {
+    || $form_state['values']['op'] == t('Reset to defaults')) {
     variable_del('color_'. $theme .'_palette');
     variable_del('color_'. $theme .'_stylesheet');
     variable_del('color_'. $theme .'_logo');
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index 3f1e76ac83c7df23cd8e8d22eaac303bec8222e5..85fe3b1821521327f909ae39acd85c51ca033aeb 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -1129,7 +1129,7 @@ function comment_confirm_delete($comment) {
     'comment_confirm_delete');
 }
 
-function comment_confirm_delete_submit($form, &$form_state, $form_values) {
+function comment_confirm_delete_submit($form, &$form_state) {
   drupal_set_message(t('The comment and all its replies have been deleted.'));
 
   $comment = $form['#comment'];
@@ -1229,9 +1229,9 @@ function comment_admin_overview($type = 'new', $arg) {
 /**
  * We can't execute any 'Update options' if no comments were selected.
  */
-function comment_admin_overview_validate($form, &$form_state, $form_values) {
-  $form_values['comments'] = array_diff($form_values['comments'], array(0));
-  if (count($form_values['comments']) == 0) {
+function comment_admin_overview_validate($form, &$form_state) {
+  $form_state['values']['comments'] = array_diff($form_state['values']['comments'], array(0));
+  if (count($form_state['values']['comments']) == 0) {
     form_set_error('', t('Please select one or more comments to perform the update on.'));
     drupal_goto('admin/content/comment');
   }
@@ -1241,19 +1241,19 @@ function comment_admin_overview_validate($form, &$form_state, $form_values) {
  * Execute the chosen 'Update option' on the selected comments, such as
  * publishing, unpublishing or deleting.
  */
-function comment_admin_overview_submit($form, &$form_state, $form_values) {
+function comment_admin_overview_submit($form, &$form_state) {
   $operations = comment_operations();
-  if ($operations[$form_values['operation']][1]) {
+  if ($operations[$form_state['values']['operation']][1]) {
     // extract the appropriate database query operation
-    $query = $operations[$form_values['operation']][1];
-    foreach ($form_values['comments'] as $cid => $value) {
+    $query = $operations[$form_state['values']['operation']][1];
+    foreach ($form_state['values']['comments'] as $cid => $value) {
       if ($value) {
         // perform the update action, then refresh node statistics
         db_query($query, $cid);
         $comment = _comment_load($cid);
         _comment_update_node_statistics($comment->nid);
         // Allow modules to respond to the updating of a comment.
-        comment_invoke_comment($comment, $form_values['operation']);
+        comment_invoke_comment($comment, $form_state['values']['operation']);
         // Add an entry to the watchdog log.
         watchdog('content', 'Comment: updated %subject.', array('%subject' => $comment->subject), WATCHDOG_NOTICE, l(t('view'), 'node/'. $comment->nid, array('fragment' => 'comment-'. $comment->cid)));
       }
@@ -1326,9 +1326,9 @@ function comment_multiple_delete_confirm() {
 /**
  * Perform the actual comment deletion.
  */
-function comment_multiple_delete_confirm_submit($form, &$form_state, $form_values) {
-  if ($form_values['confirm']) {
-    foreach ($form_values['comments'] as $cid => $value) {
+function comment_multiple_delete_confirm_submit($form, &$form_state) {
+  if ($form_state['values']['confirm']) {
+    foreach ($form_state['values']['comments'] as $cid => $value) {
       $comment = _comment_load($cid);
       _comment_delete_thread($comment);
       _comment_update_node_statistics($comment->nid);
@@ -1453,7 +1453,7 @@ function comment_validate($edit) {
 ** Generate the basic commenting form, for appending to a node or display on a separate page.
 ** This is rendered by theme_comment_form.
 */
-function comment_form($edit, $title = NULL) {
+function comment_form(&$form_state, $edit, $title = NULL) {
   global $user;
 
   $op = isset($_POST['op']) ? $_POST['op'] : '';
@@ -1684,48 +1684,48 @@ function comment_form_add_preview($form, $edit, &$form_state) {
   return $form;
 }
 
-function comment_form_validate($form, &$form_state, $form_values) {
+function comment_form_validate($form, &$form_state) {
   global $user;
   if ($user->uid === 0) {
     foreach (array('name', 'homepage', 'mail') as $field) {
       //set cookie for 365 days
-      setcookie('comment_info_'. $field, $form_values[$field], time() + 31536000);
+      setcookie('comment_info_'. $field, $form_state['values'][$field], time() + 31536000);
     }
   }
-  comment_validate($form_values);
+  comment_validate($form_state['values']);
 }
 
-function _comment_form_submit(&$form_values) {
-  if (!isset($form_values['date'])) {
-    $form_values['date'] = 'now';
+function _comment_form_submit(&$comment_values) {
+  if (!isset($comment_values['date'])) {
+    $comment_values['date'] = 'now';
   }
-  $form_values['timestamp'] = strtotime($form_values['date']);
-  if (isset($form_values['author'])) {
-    $account = user_load(array('name' => $form_values['author']));
-    $form_values['uid'] = $account->uid;
-    $form_values['name'] = $form_values['author'];
+  $comment_values['timestamp'] = strtotime($comment_values['date']);
+  if (isset($comment_values['author'])) {
+    $account = user_load(array('name' => $comment_values['author']));
+    $comment_values['uid'] = $account->uid;
+    $comment_values['name'] = $comment_values['author'];
   }
   // Validate the comment's subject. If not specified, extract
   // one from the comment's body.
-  if (trim($form_values['subject']) == '') {
+  if (trim($comment_values['subject']) == '') {
     // The body may be in any format, so we:
     // 1) Filter it into HTML
     // 2) Strip out all HTML tags
     // 3) Convert entities back to plain-text.
     // Note: format is checked by check_markup().
-    $form_values['subject'] = trim(truncate_utf8(decode_entities(strip_tags(check_markup($form_values['comment'], $form_values['format']))), 29, TRUE));
+    $comment_values['subject'] = trim(truncate_utf8(decode_entities(strip_tags(check_markup($comment_values['comment'], $comment_values['format']))), 29, TRUE));
     // Edge cases where the comment body is populated only by HTML tags will
     // require a default subject.
-    if ($form_values['subject'] == '') {
-      $form_values['subject'] = t('(No subject)');
+    if ($comment_values['subject'] == '') {
+      $comment_values['subject'] = t('(No subject)');
     }
   }
 }
 
-function comment_form_submit($form, &$form_state, $form_values) {
+function comment_form_submit($form, &$form_state) {
   _comment_form_submit($form_state['values']);
-  if ($cid = comment_save($form_values)) {
-    $form_state['redirect'] = array('node/'. $form_values['nid'], NULL, "comment-$cid");
+  if ($cid = comment_save($form_state['values'])) {
+    $form_state['redirect'] = array('node/'. $form_state['values']['nid'], NULL, "comment-$cid");
     return;
   }
 }
@@ -1809,12 +1809,12 @@ function theme_comment_controls($form) {
   return theme('box', t('Comment viewing options'), $output);
 }
 
-function comment_controls_submit($form, &$form_state, $form_values) {
+function comment_controls_submit($form, &$form_state) {
   global $user;
 
-  $mode = $form_values['mode'];
-  $order = $form_values['order'];
-  $comments_per_page = $form_values['comments_per_page'];
+  $mode = $form_state['values']['mode'];
+  $order = $form_state['values']['order'];
+  $comments_per_page = $form_state['values']['comments_per_page'];
 
   if ($user->uid) {
     $user = user_save($user, array('mode' => $mode, 'sort' => $order, 'comments_per_page' => $comments_per_page));
diff --git a/modules/contact/contact.module b/modules/contact/contact.module
index 428177ad7e5da25b95e39a2f1b7de1d80b9aa212..949898d779fec5d4216239917470561d437209df 100644
--- a/modules/contact/contact.module
+++ b/modules/contact/contact.module
@@ -209,15 +209,15 @@ function contact_admin_edit($cid = NULL) {
 /**
  * Validate the contact category edit page form submission.
  */
-function contact_admin_edit_validate($form, &$form_state, $form_values) {
-  if (empty($form_values['category'])) {
+function contact_admin_edit_validate($form, &$form_state) {
+  if (empty($form_state['values']['category'])) {
     form_set_error('category', t('You must enter a category.'));
   }
-  if (empty($form_values['recipients'])) {
+  if (empty($form_state['values']['recipients'])) {
     form_set_error('recipients', t('You must enter one or more recipients.'));
   }
   else {
-    $recipients = explode(',', $form_values['recipients']);
+    $recipients = explode(',', $form_state['values']['recipients']);
     foreach ($recipients as $recipient) {
       if (!valid_email_address(trim($recipient))) {
         form_set_error('recipients', t('%recipient is an invalid e-mail address.', array('%recipient' => $recipient)));
@@ -229,27 +229,27 @@ function contact_admin_edit_validate($form, &$form_state, $form_values) {
 /**
  * Process the contact category edit page form submission.
  */
-function contact_admin_edit_submit($form, &$form_state, $form_values) {
-  if ($form_values['selected']) {
+function contact_admin_edit_submit($form, &$form_state) {
+  if ($form_state['values']['selected']) {
     // Unselect all other contact categories.
     db_query('UPDATE {contact} SET selected = 0');
   }
-  $recipients = explode(',', $form_values['recipients']);
+  $recipients = explode(',', $form_state['values']['recipients']);
   foreach ($recipients as $key => $recipient) {
     // E-mail address validation has already been done in _validate.
     $recipients[$key] = trim($recipient);
   }
-  $form_values['recipients'] = implode(',', $recipients);
+  $form_state['values']['recipients'] = implode(',', $recipients);
   if (arg(3) == 'add') {
-    db_query("INSERT INTO {contact} (category, recipients, reply, weight, selected) VALUES ('%s', '%s', '%s', %d, %d)", $form_values['category'], $form_values['recipients'], $form_values['reply'], $form_values['weight'], $form_values['selected']);
-    drupal_set_message(t('Category %category has been added.', array('%category' => $form_values['category'])));
-    watchdog('mail', 'Contact form: category %category added.', array('%category' => $form_values['category']), WATCHDOG_NOTICE, l(t('view'), 'admin/build/contact'));
+    db_query("INSERT INTO {contact} (category, recipients, reply, weight, selected) VALUES ('%s', '%s', '%s', %d, %d)", $form_state['values']['category'], $form_state['values']['recipients'], $form_state['values']['reply'], $form_state['values']['weight'], $form_state['values']['selected']);
+    drupal_set_message(t('Category %category has been added.', array('%category' => $form_state['values']['category'])));
+    watchdog('mail', 'Contact form: category %category added.', array('%category' => $form_state['values']['category']), WATCHDOG_NOTICE, l(t('view'), 'admin/build/contact'));
 
   }
   else {
-    db_query("UPDATE {contact} SET category = '%s', recipients = '%s', reply = '%s', weight = %d, selected = %d WHERE cid = %d", $form_values['category'], $form_values['recipients'], $form_values['reply'], $form_values['weight'], $form_values['selected'], $form_values['cid']);
-    drupal_set_message(t('Category %category has been updated.', array('%category' => $form_values['category'])));
-    watchdog('mail', 'Contact form: category %category updated.', array('%category' => $form_values['category']), WATCHDOG_NOTICE, l(t('view'), 'admin/build/contact'));
+    db_query("UPDATE {contact} SET category = '%s', recipients = '%s', reply = '%s', weight = %d, selected = %d WHERE cid = %d", $form_state['values']['category'], $form_state['values']['recipients'], $form_state['values']['reply'], $form_state['values']['weight'], $form_state['values']['selected'], $form_state['values']['cid']);
+    drupal_set_message(t('Category %category has been updated.', array('%category' => $form_state['values']['category'])));
+    watchdog('mail', 'Contact form: category %category updated.', array('%category' => $form_state['values']['category']), WATCHDOG_NOTICE, l(t('view'), 'admin/build/contact'));
   }
 
   $form_state['redirect'] = 'admin/build/contact';
@@ -276,10 +276,10 @@ function contact_admin_delete($cid = NULL) {
 /**
  * Process category delete form submission.
  */
-function contact_admin_delete_submit($form, &$form_state, $form_values) {
+function contact_admin_delete_submit($form, &$form_state) {
   db_query("DELETE FROM {contact} WHERE cid = %d", arg(4));
-  drupal_set_message(t('Category %category has been deleted.', array('%category' => $form_values['category'])));
-  watchdog('mail', 'Contact form: category %category deleted.', array('%category' => $form_values['category']), WATCHDOG_NOTICE);
+  drupal_set_message(t('Category %category has been deleted.', array('%category' => $form_state['values']['category'])));
+  watchdog('mail', 'Contact form: category %category deleted.', array('%category' => $form_state['values']['category']), WATCHDOG_NOTICE);
 
   $form_state['redirect'] = 'admin/build/contact';
   return;
@@ -359,7 +359,7 @@ function contact_mail_user($recipient) {
 /**
  * Process the personal contact page form submission.
  */
-function contact_mail_user_submit($form, &$form_state, $form_values) {
+function contact_mail_user_submit($form, &$form_state) {
   global $user;
 
   $account = user_load(array('uid' => arg(1), 'status' => 1));
@@ -368,7 +368,7 @@ function contact_mail_user_submit($form, &$form_state, $form_values) {
   $message[] = t("!name (!name-url) has sent you a message via your contact form (!form-url) at !site.", array('!name' => $user->name, '!name-url' => url("user/$user->uid", array('absolute' => TRUE)), '!form-url' => url($_GET['q'], array('absolute' => TRUE)), '!site' => variable_get('site_name', 'Drupal')));
   $message[] = t("If you don't want to receive such e-mails, you can change your settings at !url.", array('!url' => url("user/$account->uid", array('absolute' => TRUE))));
   $message[] = t('Message:');
-  $message[] = $form_values['message'];
+  $message[] = $form_state['values']['message'];
 
   // Tidy up the body:
   foreach ($message as $key => $value) {
@@ -380,7 +380,7 @@ function contact_mail_user_submit($form, &$form_state, $form_values) {
   $from = $user->mail;
 
   // Format the subject:
-  $subject = '['. variable_get('site_name', 'Drupal') .'] '. $form_values['subject'];
+  $subject = '['. variable_get('site_name', 'Drupal') .'] '. $form_state['values']['subject'];
 
   // Prepare the body:
   $body = implode("\n\n", $message);
@@ -389,7 +389,7 @@ function contact_mail_user_submit($form, &$form_state, $form_values) {
   drupal_mail('contact-user-mail', $to, $subject, $body, $from);
 
   // Send a copy if requested:
-  if ($form_values['copy']) {
+  if ($form_state['values']['copy']) {
     drupal_mail('contact-user-copy', $from, $subject, $body, $from);
   }
 
@@ -496,11 +496,11 @@ function contact_mail_page() {
 /**
  * Validate the site-wide contact page form submission.
  */
-function contact_mail_page_validate($form, &$form_state, $form_values) {
-  if (!$form_values['cid']) {
+function contact_mail_page_validate($form, &$form_state) {
+  if (!$form_state['values']['cid']) {
     form_set_error('category', t('You must select a valid category.'));
   }
-  if (!valid_email_address($form_values['mail'])) {
+  if (!valid_email_address($form_state['values']['mail'])) {
     form_set_error('mail', t('You must enter a valid e-mail address.'));
   }
 }
@@ -508,15 +508,15 @@ function contact_mail_page_validate($form, &$form_state, $form_values) {
 /**
  * Process the site-wide contact page form submission.
  */
-function contact_mail_page_submit($form, &$form_state, $form_values) {
+function contact_mail_page_submit($form, &$form_state) {
 
   // E-mail address of the sender: as the form field is a text field,
   // all instances of \r and \n have been automatically stripped from it.
-  $from = $form_values['mail'];
+  $from = $form_state['values']['mail'];
 
   // Compose the body:
-  $message[] = t("!name sent a message using the contact form at !form.", array('!name' => $form_values['name'], '!form' => url($_GET['q'], array('absolute' => TRUE))));
-  $message[] = $form_values['message'];
+  $message[] = t("!name sent a message using the contact form at !form.", array('!name' => $form_state['values']['name'], '!form' => url($_GET['q'], array('absolute' => TRUE))));
+  $message[] = $form_state['values']['message'];
 
   // Tidy up the body:
   foreach ($message as $key => $value) {
@@ -524,10 +524,10 @@ function contact_mail_page_submit($form, &$form_state, $form_values) {
   }
 
   // Load the category information:
-  $contact = db_fetch_object(db_query("SELECT * FROM {contact} WHERE cid = %d", $form_values['cid']));
+  $contact = db_fetch_object(db_query("SELECT * FROM {contact} WHERE cid = %d", $form_state['values']['cid']));
 
   // Format the category:
-  $subject = t('[!category] !subject', array('!category' => $contact->category, '!subject' => $form_values['subject']));
+  $subject = t('[!category] !subject', array('!category' => $contact->category, '!subject' => $form_state['values']['subject']));
 
   // Prepare the body:
   $body = implode("\n\n", $message);
@@ -536,7 +536,7 @@ function contact_mail_page_submit($form, &$form_state, $form_values) {
   drupal_mail('contact-page-mail', $contact->recipients, $subject, $body, $from);
 
   // If the user requests it, send a copy.
-  if ($form_values['copy']) {
+  if ($form_state['values']['copy']) {
     drupal_mail('contact-page-copy', $from, $subject, $body, $from);
   }
 
@@ -547,7 +547,7 @@ function contact_mail_page_submit($form, &$form_state, $form_values) {
 
   // Log the operation:
   flood_register_event('contact');
-  watchdog('mail', '%name-from sent an e-mail regarding %category.', array('%name-from' => $form_values['name'] ." [$from]", '%category' => $contact->category));
+  watchdog('mail', '%name-from sent an e-mail regarding %category.', array('%name-from' => $form_state['values']['name'] ." [$from]", '%category' => $contact->category));
 
   // Update user:
   drupal_set_message(t('Your message has been sent.'));
diff --git a/modules/dblog/dblog.module b/modules/dblog/dblog.module
index f9e918154e354be47198280d283e3f904450fc62..06896db13bc51dab029d81e8bb94f100a7d566a1 100644
--- a/modules/dblog/dblog.module
+++ b/modules/dblog/dblog.module
@@ -369,8 +369,8 @@ function theme_dblog_filters($form) {
   return $output;
 }
 
-function dblog_filter_form_validate($form, &$form_state, $form_values) {
-  if ($form_values['op'] == t('Filter') && empty($form_values['type']) && empty($form_values['severity'])) {
+function dblog_filter_form_validate($form, &$form_state) {
+  if ($form_state['values']['op'] == t('Filter') && empty($form_state['values']['type']) && empty($form_state['values']['severity'])) {
     form_set_error('type', t('You must select something to filter by.'));
   }
 }
@@ -378,14 +378,14 @@ function dblog_filter_form_validate($form, &$form_state, $form_values) {
 /**
  * Process result from dblog administration filter form.
  */
-function dblog_filter_form_submit($form_id, $form_values, &$form_state) {
-  $op = $form_values['op'];
+function dblog_filter_form_submit($form, &$form_state) {
+  $op = $form_state['values']['op'];
   $filters = dblog_filters();
   switch ($op) {
     case t('Filter'):
       foreach ($filters as $name => $filter) {
-        if (isset($form_values[$name])) {
-          $_SESSION['dblog_overview_filter'][$name] = $form_values[$name];
+        if (isset($form_state['values'][$name])) {
+          $_SESSION['dblog_overview_filter'][$name] = $form_state['values'][$name];
         }
       }
       break;
diff --git a/modules/filter/filter.module b/modules/filter/filter.module
index 74ec80484947ddac4e5922614bb95048f5e9388f..2683990fcccffb3aaf9d5112f9b0fd59f07b1a29 100644
--- a/modules/filter/filter.module
+++ b/modules/filter/filter.module
@@ -296,11 +296,11 @@ function filter_admin_overview() {
   return $form;
 }
 
-function filter_admin_overview_submit($form, &$form_state, $form_values) {
+function filter_admin_overview_submit($form, &$form_state) {
   // Process form submission to set the default format
-  if (is_numeric($form_values['default'])) {
+  if (is_numeric($form_state['values']['default'])) {
     drupal_set_message(t('Default format updated.'));
-    variable_set('filter_default_format', $form_values['default']);
+    variable_set('filter_default_format', $form_state['values']['default']);
   }
 }
 
@@ -352,18 +352,18 @@ function filter_admin_delete() {
 /**
  * Process filter delete form submission.
  */
-function filter_admin_delete_submit($form, &$form_state, $form_values) {
-  db_query("DELETE FROM {filter_formats} WHERE format = %d", $form_values['format']);
-  db_query("DELETE FROM {filters} WHERE format = %d", $form_values['format']);
+function filter_admin_delete_submit($form, &$form_state) {
+  db_query("DELETE FROM {filter_formats} WHERE format = %d", $form_state['values']['format']);
+  db_query("DELETE FROM {filters} WHERE format = %d", $form_state['values']['format']);
 
   $default = variable_get('filter_default_format', 1);
   // Replace existing instances of the deleted format with the default format.
-  db_query("UPDATE {node_revisions} SET format = %d WHERE format = %d", $default, $form_values['format']);
-  db_query("UPDATE {comments} SET format = %d WHERE format = %d", $default, $form_values['format']);
-  db_query("UPDATE {boxes} SET format = %d WHERE format = %d", $default, $form_values['format']);
+  db_query("UPDATE {node_revisions} SET format = %d WHERE format = %d", $default, $form_state['values']['format']);
+  db_query("UPDATE {comments} SET format = %d WHERE format = %d", $default, $form_state['values']['format']);
+  db_query("UPDATE {boxes} SET format = %d WHERE format = %d", $default, $form_state['values']['format']);
 
-  cache_clear_all($form_values['format'] .':', 'cache_filter', TRUE);
-  drupal_set_message(t('Deleted input format %format.', array('%format' => $form_values['name'])));
+  cache_clear_all($form_state['values']['format'] .':', 'cache_filter', TRUE);
+  drupal_set_message(t('Deleted input format %format.', array('%format' => $form_state['values']['name'])));
 
   $form_state['redirect'] = 'admin/settings/filters';
   return;
@@ -372,7 +372,7 @@ function filter_admin_delete_submit($form, &$form_state, $form_values) {
 /**
  * Generate a filter format form.
  */
-function filter_admin_format_form($format = NULL) {
+function filter_admin_format_form(&$form_state, $format = NULL) {
   $default = ($format->format == variable_get('filter_default_format', 1));
   if ($default) {
     $help = t('All roles for the default format must be enabled and cannot be changed.');
@@ -442,9 +442,9 @@ function filter_admin_format_form($format = NULL) {
 /**
  * Validate filter format form submissions.
  */
-function filter_admin_format_form_validate($form, &$form_state, $form_values) {
-  if (!isset($form_values['format'])) {
-    $name = trim($form_values['name']);
+function filter_admin_format_form_validate($form, &$form_state) {
+  if (!isset($form_state['values']['format'])) {
+    $name = trim($form_state['values']['name']);
     $result = db_fetch_object(db_query("SELECT format FROM {filter_formats} WHERE name='%s'", $name));
     if ($result) {
       form_set_error('name', t('Filter format names need to be unique. A format named %name already exists.', array('%name' => $name)));
@@ -455,10 +455,10 @@ function filter_admin_format_form_validate($form, &$form_state, $form_values) {
 /**
  * Process filter format form submissions.
  */
-function filter_admin_format_form_submit($form, &$form_state, $form_values) {
-  $format = isset($form_values['format']) ? $form_values['format'] : NULL;
+function filter_admin_format_form_submit($form, &$form_state) {
+  $format = isset($form_state['values']['format']) ? $form_state['values']['format'] : NULL;
   $current = filter_list_format($format);
-  $name = trim($form_values['name']);
+  $name = trim($form_state['values']['name']);
   $cache = TRUE;
 
   // Add a new filter format.
@@ -473,7 +473,7 @@ function filter_admin_format_form_submit($form, &$form_state, $form_values) {
   }
 
   db_query("DELETE FROM {filters} WHERE format = %d", $format);
-  foreach ($form_values['filters'] as $id => $checked) {
+  foreach ($form_state['values']['filters'] as $id => $checked) {
     if ($checked) {
       list($module, $delta) = explode('/', $id);
       // Add new filters to the bottom.
@@ -489,14 +489,14 @@ function filter_admin_format_form_submit($form, &$form_state, $form_values) {
   // We should always set all roles to TRUE when saving a default role.
   // We use leading and trailing comma's to allow easy substring matching.
   $roles = array();
-  if (isset($form_values['roles'])) {
-    foreach ($form_values['roles'] as $id => $checked) {
+  if (isset($form_state['values']['roles'])) {
+    foreach ($form_state['values']['roles'] as $id => $checked) {
       if ($checked) {
         $roles[] = $id;
       }
     }
   }
-  $roles = ','. implode(',', ($form_values['default_format'] ? array_keys(user_roles()) : $roles)) .',';
+  $roles = ','. implode(',', ($form_state['values']['default_format'] ? array_keys(user_roles()) : $roles)) .',';
 
   db_query("UPDATE {filter_formats} SET cache = %d, name='%s', roles = '%s' WHERE format = %d", $cache, $name, $roles, $format);
 
@@ -514,7 +514,7 @@ function filter_admin_format_form_submit($form, &$form_state, $form_values) {
 /**
  * Menu callback; display form for ordering filters for a format.
  */
-function filter_admin_order($format = NULL) {
+function filter_admin_order(&$form_state, $format = NULL) {
   // Get list (with forced refresh)
   $filters = filter_list_format($format->format);
 
@@ -551,20 +551,20 @@ function theme_filter_admin_order($form) {
 /**
  * Process filter order configuration form submission.
  */
-function filter_admin_order_submit($form, &$form_state, $form_values) {
-  foreach ($form_values['weights'] as $id => $weight) {
+function filter_admin_order_submit($form, &$form_state) {
+  foreach ($form_state['values']['weights'] as $id => $weight) {
     list($module, $delta) = explode('/', $id);
-    db_query("UPDATE {filters} SET weight = %d WHERE format = %d AND module = '%s' AND delta = %d", $weight, $form_values['format'], $module, $delta);
+    db_query("UPDATE {filters} SET weight = %d WHERE format = %d AND module = '%s' AND delta = %d", $weight, $form_state['values']['format'], $module, $delta);
   }
   drupal_set_message(t('The filter ordering has been saved.'));
 
-  cache_clear_all($form_values['format'] .':', 'cache_filter', TRUE);
+  cache_clear_all($form_state['values']['format'] .':', 'cache_filter', TRUE);
 }
 
 /**
  * Menu callback; display settings defined by filters.
  */
-function filter_admin_configure($format) {
+function filter_admin_configure(&$form_state, $format) {
   $list = filter_list_format($format->format);
   $form = array();
   foreach ($list as $filter) {
@@ -1553,4 +1553,3 @@ function filter_xss_bad_protocol($string, $decode = TRUE) {
 /**
  * @} End of "Standard filters".
  */
-
diff --git a/modules/forum/forum.module b/modules/forum/forum.module
index 3183480bee75eea8ab103d3bc1e65ae70eda4688..461d6e545f2c0a745c0baa7d38e57d1d3739766c 100644
--- a/modules/forum/forum.module
+++ b/modules/forum/forum.module
@@ -412,7 +412,7 @@ function forum_update($node) {
 /**
  * Implementation of hook_form().
  */
-function forum_form(&$node) {
+function forum_form(&$node, $form_state) {
   $type = node_get_types('type', $node);
   $form['title'] = array('#type' => 'textfield', '#title' => check_plain($type->title_label), '#default_value' => !empty($node->title) ? $node->title : '', '#required' => TRUE, '#weight' => -5);
 
@@ -461,7 +461,7 @@ function forum_delete(&$node) {
  *
  * @param $edit Associative array containing a container term to be added or edited.
  */
-function forum_form_container($edit = array()) {
+function forum_form_container(&$form_state, $edit = array()) {
   $edit += array(
     'name' => '',
     'description' => '',
@@ -528,7 +528,7 @@ function forum_form_main($type, $edit = array()) {
  *
  * @param $edit Associative array containing a forum term to be added or edited.
  */
-function forum_form_forum($edit = array()) {
+function forum_form_forum(&$form_state, $edit = array()) {
   $edit += array(
     'name' => '',
     'description' => '',
@@ -571,7 +571,7 @@ function forum_form_forum($edit = array()) {
 /**
  * Process forum form and container form submissions.
  */
-function forum_form_submit($form, &$form_state, $form_values) {
+function forum_form_submit($form, &$form_state) {
   if ($form['form_id']['#value'] == 'forum_form_container') {
     $container = TRUE;
     $type = t('forum container');
@@ -581,18 +581,18 @@ function forum_form_submit($form, &$form_state, $form_values) {
     $type = t('forum');
   }
 
-  $status = taxonomy_save_term($form_values);
+  $status = taxonomy_save_term($form_state['values']);
   switch ($status) {
     case SAVED_NEW:
       if ($container) {
         $containers = variable_get('forum_containers', array());
-        $containers[] = $form_values['tid'];
+        $containers[] = $form_state['values']['tid'];
         variable_set('forum_containers', $containers);
       }
-      drupal_set_message(t('Created new @type %term.', array('%term' => $form_values['name'], '@type' => $type)));
+      drupal_set_message(t('Created new @type %term.', array('%term' => $form_state['values']['name'], '@type' => $type)));
       break;
     case SAVED_UPDATED:
-      drupal_set_message(t('The @type %term has been updated.', array('%term' => $form_values['name'], '@type' => $type)));
+      drupal_set_message(t('The @type %term has been updated.', array('%term' => $form_state['values']['name'], '@type' => $type)));
       break;
   }
   $form_state['redirect'] = 'admin/content/forum';
@@ -616,10 +616,10 @@ function forum_confirm_delete($tid) {
 /**
  * Implementation of forms api _submit call. Deletes a forum after confirmation.
  */
-function forum_confirm_delete_submit($form, &$form_state, $form_values) {
-  taxonomy_del_term($form_values['tid']);
-  drupal_set_message(t('The forum %term and all sub-forums and associated posts have been deleted.', array('%term' => $form_values['name'])));
-  watchdog('content', 'forum: deleted %term and all its sub-forums and associated posts.', array('%term' => $form_values['name']));
+function forum_confirm_delete_submit($form, &$form_state) {
+  taxonomy_del_term($form_state['values']['tid']);
+  drupal_set_message(t('The forum %term and all sub-forums and associated posts have been deleted.', array('%term' => $form_state['values']['name'])));
+  watchdog('content', 'forum: deleted %term and all its sub-forums and associated posts.', array('%term' => $form_state['values']['name']));
 
   $form_state['redirect'] = 'admin/content/forum';
   return;
@@ -1185,5 +1185,3 @@ function _forum_get_topic_order_sql($sortby) {
   $order = _forum_get_topic_order($sortby);
   return $order['field'] .' '. $order['sort'];
 }
-
-
diff --git a/modules/menu/menu.module b/modules/menu/menu.module
index d7ce16b7bc1e354414bb8c25c562bb98b306c668..2fde04f72fd60d83efa6bdbecf470d42d13dc61e 100644
--- a/modules/menu/menu.module
+++ b/modules/menu/menu.module
@@ -217,7 +217,7 @@ function menu_flip_item($visible, $mid, $path = NULL) {
 /**
  * Present the menu item editing form.
  */
-function menu_edit_item_form($type, $mid = 0) {
+function menu_edit_item_form(&$form_state, $type, $mid = 0) {
   if ($type == 'edit') {
     if (!($item = menu_get_item_by_mid($mid))) {
       drupal_not_found();
@@ -294,9 +294,9 @@ function menu_edit_item_form($type, $mid = 0) {
   return $form;
 }
 
-function menu_edit_item_form_validate($form, &$form_state, $form_values) {
-  if (isset($form_values['path'])) {
-    $path = $form_values['path'];
+function menu_edit_item_form_validate($form, &$form_state) {
+  if (isset($form_state['values']['path'])) {
+    $path = $form_state['values']['path'];
     // Skip external links.
     $colonpos = strpos($path, ':');
     if ($colonpos !== FALSE && !preg_match('![/?#]!', substr($path, 0, $colonpos))) {
@@ -306,7 +306,7 @@ function menu_edit_item_form_validate($form, &$form_state, $form_values) {
     if (!$item || !$item->access) {
       form_set_error('path', t('This path is either invalid or you do not have access to it'));
     }
-    elseif ($path != $form_values['original_path'] && $item->path == $path) {
+    elseif ($path != $form_state['values']['original_path'] && $item->path == $path) {
       form_set_error('path', t('There is already a menu item pointing to this path.'));
     }
   }
@@ -314,8 +314,8 @@ function menu_edit_item_form_validate($form, &$form_state, $form_values) {
 /**
  * Process menu and menu item add/edit form submissions.
  */
-function menu_edit_item_form_submit($form, &$form_state, $form_values) {
-  menu_edit_item_save($form_values);
+function menu_edit_item_form_submit($form, &$form_state) {
+  menu_edit_item_save($form_state['values']);
   $form_state['redirect'] = 'admin/build/menu';
   return;
 }
@@ -412,7 +412,7 @@ function menu_node_form_delete($node) {
 /**
  * Menu callback; handle the adding/editing of a new menu.
  */
-function menu_edit_menu_form($type, $mid = 0) {
+function menu_edit_menu_form(&$form_state, $type, $mid = 0) {
   if ($type == 'edit') {
     if (!$item = menu_get_item_by_mid($mid)) {
       drupal_not_found();
@@ -445,7 +445,7 @@ function menu_edit_menu_form($type, $mid = 0) {
 /**
  * Menu callback; delete a single custom item.
  */
-function menu_item_delete_form($mid) {
+function menu_item_delete_form(&$form_state, $mid) {
   if (!($menu = db_fetch_object(db_query('SELECT type, path, title FROM {menu} WHERE mid = %d', $mid)))) {
     drupal_not_found();
     return;
@@ -468,11 +468,11 @@ function menu_item_delete_form($mid) {
 /**
  * Process menu delete form submissions.
  */
-function menu_item_delete_form_submit($form, &$form_state, $form_values) {
-  menu_delete_item($form_values['path']);
+function menu_item_delete_form_submit($form, &$form_state) {
+  menu_delete_item($form_state['values']['path']);
 
-  $t_args = array('%title' => $form_values['title']);
-  if ($form_values['type'] & MENU_IS_ROOT) {
+  $t_args = array('%title' => $form_state['values']['title']);
+  if ($form_state['values']['type'] & MENU_IS_ROOT) {
     drupal_set_message(t('The menu %title has been deleted.', $t_args));
     watchdog('menu', 'Deleted menu %title.', $t_args, WATCHDOG_NOTICE);
   }
@@ -501,8 +501,8 @@ function menu_reset_item($mid) {
 /**
  * Process menu reset item form submissions.
  */
-function menu_reset_item_submit($form, &$form_state, $form_values) {
-  menu_delete_item($form_values['mid']);
+function menu_reset_item_submit($form, &$form_state) {
+  menu_delete_item($form_state['values']['mid']);
   drupal_set_message(t('The menu item was reset to its default settings.'));
 
   $form_state['redirect'] = 'admin/build/menu';
diff --git a/modules/node/content_types.inc b/modules/node/content_types.inc
index 39ace1a35cc37673b5999333fe0e3e0b473a41cb..c2fb2fcec097999d1e9ea70e7dd31ff09e5bdcd6 100644
--- a/modules/node/content_types.inc
+++ b/modules/node/content_types.inc
@@ -49,7 +49,7 @@ function node_overview_types() {
 /**
  * Generates the node type editing form.
  */
-function node_type_form($type = NULL) {
+function node_type_form(&$form_state, $type = NULL) {
   if (!isset($type->type)) {
     $type = new stdClass();
     $type->type = $type->name = $type->module = $type->description = $type->help = '';
@@ -216,20 +216,20 @@ function node_type_form($type = NULL) {
 /**
  * Implementation of hook_form_validate().
  */
-function node_type_form_validate($form, &$form_state, $form_values) {
+function node_type_form_validate($form, &$form_state) {
   $type = new stdClass();
-  $type->type = trim($form_values['type']);
-  $type->name = trim($form_values['name']);
+  $type->type = trim($form_state['values']['type']);
+  $type->name = trim($form_state['values']['name']);
 
   // Work out what the type was before the user submitted this form
-  $old_type = trim($form_values['old_type']);
+  $old_type = trim($form_state['values']['old_type']);
   if (empty($old_type)) {
     $old_type = $type->type;
   }
 
   $types = node_get_types('names');
 
-  if (!$form_values['locked']) {
+  if (!$form_state['values']['locked']) {
     if (isset($types[$type->type]) && $type->type != $old_type) {
       form_set_error('type', t('The machine-readable name %type is already taken.', array('%type' => $type->type)));
     }
@@ -252,31 +252,31 @@ function node_type_form_validate($form, &$form_state, $form_values) {
 /**
  * Implementation of hook_form_submit().
  */
-function node_type_form_submit($form, &$form_state, $form_values) {
-  $op = isset($form_values['op']) ? $form_values['op'] : '';
+function node_type_form_submit($form, &$form_state) {
+  $op = isset($form_state['values']['op']) ? $form_state['values']['op'] : '';
 
   $type = new stdClass();
 
-  $type->type = trim($form_values['type']);
-  $type->name = trim($form_values['name']);
-  $type->orig_type = trim($form_values['orig_type']);
-  $type->old_type = isset($form_values['old_type']) ? $form_values['old_type'] : $type->type;
+  $type->type = trim($form_state['values']['type']);
+  $type->name = trim($form_state['values']['name']);
+  $type->orig_type = trim($form_state['values']['orig_type']);
+  $type->old_type = isset($form_state['values']['old_type']) ? $form_state['values']['old_type'] : $type->type;
 
-  $type->description = $form_values['description'];
-  $type->help = $form_values['help'];
-  $type->min_word_count = $form_values['min_word_count'];
-  $type->title_label = $form_values['title_label'];
-  $type->body_label = $form_values['body_label'];
+  $type->description = $form_state['values']['description'];
+  $type->help = $form_state['values']['help'];
+  $type->min_word_count = $form_state['values']['min_word_count'];
+  $type->title_label = $form_state['values']['title_label'];
+  $type->body_label = $form_state['values']['body_label'];
 
   // title_label is required in core; has_title will always be true, unless a
   // module alters the title field.
   $type->has_title = ($type->title_label != '');
   $type->has_body = ($type->body_label != '');
 
-  $type->module = !empty($form_values['module']) ? $form_values['module'] : 'node';
-  $type->custom = $form_values['custom'];
+  $type->module = !empty($form_state['values']['module']) ? $form_state['values']['module'] : 'node';
+  $type->custom = $form_state['values']['custom'];
   $type->modified = TRUE;
-  $type->locked = $form_values['locked'];
+  $type->locked = $form_state['values']['locked'];
 
   if ($op == t('Reset to defaults')) {
     node_type_reset($type);
@@ -288,7 +288,7 @@ function node_type_form_submit($form, &$form_state, $form_values) {
 
   $status = node_type_save($type);
 
-  $variables = $form_values;
+  $variables = $form_state['values'];
 
   // Remove everything that's been saved already - whatever's left is assumed
   // to be a persistent variable.
@@ -398,10 +398,10 @@ function node_type_delete_confirm($type) {
 /**
  * Process content type delete confirm submissions.
  */
-function node_type_delete_confirm_submit($form, &$form_state, $form_values) {
-  node_type_delete($form_values['type']);
+function node_type_delete_confirm_submit($form, &$form_state) {
+  node_type_delete($form_state['values']['type']);
 
-  $t_args = array('%name' => $form_values['name']);
+  $t_args = array('%name' => $form_state['values']['name']);
   drupal_set_message(t('The content type %name has been deleted.', $t_args));
   watchdog('menu', 'Deleted content type %name.', $t_args, WATCHDOG_NOTICE);
 
diff --git a/modules/node/node.module b/modules/node/node.module
index 1bde5c8fc507d1c80c8e33388a7ded82d9f8f4f2..468df71a3b3380049a7ab8617e1d5ddd8f5787d3 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -173,16 +173,16 @@ function node_mark($nid, $timestamp) {
 /**
  * See if the user used JS to submit a teaser.
  */
-function node_teaser_js(&$form, $form_values, &$form_state) {
+function node_teaser_js(&$form, &$form_state) {
   // Glue the teaser to the body.
   if (isset($form['#post']['teaser_js'])) {
-    if (trim($form_values['teaser_js'])) {
+    if (trim($form_state['values']['teaser_js'])) {
       // Space the teaser from the body
-      $body = trim($form_values['teaser_js']) ."\r\n<!--break-->\r\n". trim($form_values['body']);
+      $body = trim($form_state['values']['teaser_js']) ."\r\n<!--break-->\r\n". trim($form_state['values']['body']);
     }
     else {
       // Empty teaser, no spaces.
-      $body = '<!--break-->'. $form_values['body'];
+      $body = '<!--break-->'. $form_state['values']['body'];
     }
     // Pass value onto preview/submit
     form_set_value($form['body'], $body, $form_state);
@@ -1066,8 +1066,8 @@ function node_configure() {
 /**
  * Form validate callback.
  */
-function node_configure_validate($form, &$form_state, $form_values) {
-  if ($form_values['op'] == t('Rebuild permissions')) {
+function node_configure_validate($form, &$form_state) {
+  if ($form_state['values']['op'] == t('Rebuild permissions')) {
     drupal_goto('admin/content/node-settings/rebuild');
   }
 }
@@ -1521,19 +1521,19 @@ function theme_node_filters($form) {
 /**
  * Process result from node administration filter form.
  */
-function node_filter_form_submit($form, &$form_state, $form_values) {
+function node_filter_form_submit($form, &$form_state) {
   $filters = node_filters();
-  switch ($form_values['op']) {
+  switch ($form_state['values']['op']) {
     case t('Filter'):
     case t('Refine'):
-      if (isset($form_values['filter'])) {
-        $filter = $form_values['filter'];
+      if (isset($form_state['values']['filter'])) {
+        $filter = $form_state['values']['filter'];
 
         // Flatten the options array to accommodate hierarchical/nested options.
         $flat_options = form_options_flatten($filters[$filter]['options']);
 
-        if (isset($flat_options[$form_values[$filter]])) {
-          $_SESSION['node_overview_filter'][] = array($filter, $form_values[$filter]);
+        if (isset($flat_options[$form_state['values'][$filter]])) {
+          $_SESSION['node_overview_filter'][] = array($filter, $form_state['values'][$filter]);
         }
       }
       break;
@@ -1549,11 +1549,11 @@ function node_filter_form_submit($form, &$form_state, $form_values) {
 /**
  * Submit the node administration update form.
  */
-function node_admin_nodes_submit($form, &$form_state, $form_values) {
+function node_admin_nodes_submit($form, &$form_state) {
   $operations = module_invoke_all('node_operations');
-  $operation = $operations[$form_values['operation']];
+  $operation = $operations[$form_state['values']['operation']];
   // Filter out unchecked nodes
-  $nodes = array_filter($form_values['nodes']);
+  $nodes = array_filter($form_state['values']['nodes']);
   if ($function = $operation['callback']) {
     // Add in callback arguments if present.
     if (isset($operation['callback arguments'])) {
@@ -1569,8 +1569,8 @@ function node_admin_nodes_submit($form, &$form_state, $form_values) {
   }
 }
 
-function node_admin_nodes_validate($form, &$form_state, $form_values) {
-  $nodes = array_filter($form_values['nodes']);
+function node_admin_nodes_validate($form, &$form_state) {
+  $nodes = array_filter($form_state['values']['nodes']);
   if (count($nodes) == 0) {
     form_set_error('', t('No items selected.'));
   }
@@ -1690,9 +1690,9 @@ function node_multiple_delete_confirm() {
                       t('Delete all'), t('Cancel'));
 }
 
-function node_multiple_delete_confirm_submit($form, &$form_state, $form_values) {
-  if ($form_values['confirm']) {
-    foreach ($form_values['nodes'] as $nid => $value) {
+function node_multiple_delete_confirm_submit($form, &$form_state) {
+  if ($form_state['values']['confirm']) {
+    foreach ($form_state['values']['nodes'] as $nid => $value) {
       node_delete($nid);
     }
     drupal_set_message(t('The items have been deleted.'));
@@ -2007,8 +2007,8 @@ function node_validate($node, $form = array()) {
   node_invoke_nodeapi($node, 'validate', $form);
 }
 
-function node_form_validate($form, &$form_state, $form_values) {
-  node_validate($form_values, $form);
+function node_form_validate($form, &$form_state) {
+  node_validate($form_state['values'], $form);
 }
 
 function node_object_prepare(&$node) {
@@ -2029,7 +2029,7 @@ function node_object_prepare(&$node) {
 /**
  * Generate the node add/edit form array.
  */
-function node_form($node, $form_state = NULL) {
+function node_form(&$form_state, $node) {
   global $user;
 
   if (isset($form_state['node'])) {
@@ -2148,20 +2148,12 @@ function node_form($node, $form_state = NULL) {
   return $form;
 }
 
-function node_form_build_preview($form, &$form_state, $form_values) {
+function node_form_build_preview($form, &$form_state) {
   // We do not want to execute button level handlers, we want the form level
   // handlers to go in and change the submitted values.
   unset($form_state['submit_handlers']);
   form_execute_handlers('submit', $form, $form_state);
-  // Because the node preview may display a form, we must render it
-  // outside the node submission form tags using the #prefix property
-  // (i.e. to prevent illegally nested forms).
-  // If the node form already has a #prefix, we must preserve it.
-  // In this case, we put the preview before the #prefix so we keep
-  // the #prefix as "close" to the rest of the form as possible,
-  // for example, to keep a <div> only around the form, not the
-  // preview. We pass the global $form_values here to preserve
-  // changes made during form validation.
+
   $form_state['node_preview'] = node_preview((object)$form_state['values']);
   $form_state['rebuild'] = TRUE;
   $form_state['node'] = $form_state['values'];
@@ -2315,7 +2307,7 @@ function theme_node_log_message($log) {
   return '<div class="log"><div class="title">'. t('Log') .':</div>'. $log .'</div>';
 }
 
-function node_form_submit($form, &$form_state, $form_values) {
+function node_form_submit($form, &$form_state) {
   global $user;
 
   // We do not want to execute button level handlers, we want the form level
@@ -2325,12 +2317,12 @@ function node_form_submit($form, &$form_state, $form_values) {
 
   // Normally, we don't want people doing anything even remotely like this.
   // For the node submission form, however, it's necessary. Submit handlers
-  // alter the $form_values collection to determine what ultimately makes it
+  // alter the $form_state['values'] collection to determine what ultimately makes it
   // into the final $node object.
-  $form_values = $form_state['values'];
+  $form_state['values'] = $form_state['values'];
 
   // Fix up the node when required:
-  $node = node_submit($form_values);
+  $node = node_submit($form_state['values']);
 
   // Prepare the node's body:
   if ($node->nid) {
@@ -2368,9 +2360,9 @@ function node_delete_confirm($node) {
 /**
  * Execute node deletion
  */
-function node_delete_confirm_submit($form, &$form_state, $form_values) {
-  if ($form_values['confirm']) {
-    node_delete($form_values['nid']);
+function node_delete_confirm_submit($form, &$form_state) {
+  if ($form_state['values']['confirm']) {
+    node_delete($form_state['values']['nid']);
   }
 
   $form_state['redirect'] = '<front>';
@@ -2630,34 +2622,34 @@ function node_form_alter(&$form, $form_state, $form_id) {
 /**
  * Form API callback for the search form. Registered in node_form_alter().
  */
-function node_search_validate($form, &$form_state, $form_values) {
+function node_search_validate($form, &$form_state) {
   // Initialise using any existing basic search keywords.
-  $keys = $form_values['processed_keys'];
+  $keys = $form_state['values']['processed_keys'];
 
   // Insert extra restrictions into the search keywords string.
-  if (isset($form_values['type']) && is_array($form_values['type'])) {
+  if (isset($form_state['values']['type']) && is_array($form_state['values']['type'])) {
     // Retrieve selected types - Forms API sets the value of unselected checkboxes to 0.
-    $form_values['type'] = array_filter($form_values['type']);
-    if (count($form_values['type'])) {
-      $keys = search_query_insert($keys, 'type', implode(',', array_keys($form_values['type'])));
+    $form_state['values']['type'] = array_filter($form_state['values']['type']);
+    if (count($form_state['values']['type'])) {
+      $keys = search_query_insert($keys, 'type', implode(',', array_keys($form_state['values']['type'])));
     }
   }
 
-  if (isset($form_values['category']) && is_array($form_values['category'])) {
-    $keys = search_query_insert($keys, 'category', implode(',', $form_values['category']));
+  if (isset($form_state['values']['category']) && is_array($form_state['values']['category'])) {
+    $keys = search_query_insert($keys, 'category', implode(',', $form_state['values']['category']));
   }
-  if ($form_values['or'] != '') {
-    if (preg_match_all('/ ("[^"]+"|[^" ]+)/i', ' '. $form_values['or'], $matches)) {
+  if ($form_state['values']['or'] != '') {
+    if (preg_match_all('/ ("[^"]+"|[^" ]+)/i', ' '. $form_state['values']['or'], $matches)) {
       $keys .= ' '. implode(' OR ', $matches[1]);
     }
   }
-  if ($form_values['negative'] != '') {
-    if (preg_match_all('/ ("[^"]+"|[^" ]+)/i', ' '. $form_values['negative'], $matches)) {
+  if ($form_state['values']['negative'] != '') {
+    if (preg_match_all('/ ("[^"]+"|[^" ]+)/i', ' '. $form_state['values']['negative'], $matches)) {
       $keys .= ' -'. implode(' -', $matches[1]);
     }
   }
-  if ($form_values['phrase'] != '') {
-    $keys .= ' "'. str_replace('"', ' ', $form_values['phrase']) .'"';
+  if ($form_state['values']['phrase'] != '') {
+    $keys .= ' "'. str_replace('"', ' ', $form_state['values']['phrase']) .'"';
   }
   if (!empty($keys)) {
     form_set_value($form['basic']['inline']['processed_keys'], trim($keys), $form_state);
@@ -3060,7 +3052,7 @@ function node_body_field(&$node, $label, $word_count) {
 /**
  * Implementation of hook_form().
  */
-function node_content_form($node) {
+function node_content_form($node, $form_state) {
   $type = node_get_types('type', $node);
   $form = array();
 
diff --git a/modules/path/path.module b/modules/path/path.module
index df822845195ea021d92f6e348dc217a42a2e887f..bb182066214d8e9c1a9a4326bd71c918aaeb8626 100644
--- a/modules/path/path.module
+++ b/modules/path/path.module
@@ -105,9 +105,9 @@ function path_admin_delete_confirm($pid) {
 /**
  * Execute URL alias deletion
  **/
-function path_admin_delete_confirm_submit($form, &$form_state, $form_values) {
-  if ($form_values['confirm']) {
-    path_admin_delete($form_values['pid']);
+function path_admin_delete_confirm_submit($form, &$form_state) {
+  if ($form_state['values']['confirm']) {
+    path_admin_delete($form_state['values']['pid']);
     $form_state['redirect'] = 'admin/build/path';
     return;
   }
@@ -175,7 +175,7 @@ function path_set_alias($path = NULL, $alias = NULL, $pid = NULL, $language = ''
 /**
  * Return a form for editing or creating an individual URL alias.
  */
-function path_form($edit = array('src' => '', 'dst' => '', 'language' => '', 'pid' => NULL)) {
+function path_form(&$form_state, $edit = array('src' => '', 'dst' => '', 'language' => '', 'pid' => NULL)) {
   $form['#submit'][] = 'path_form_submit';
   $form['#validate'][] = 'path_form_validate';
   $form['#alias'] = $edit;
@@ -367,12 +367,12 @@ function path_load($pid) {
 /**
  * Verify that a new URL alias is valid
  */
-function path_form_validate($form, &$form_state, $form_values) {
-  $src = $form_values['src'];
-  $dst = $form_values['dst'];
-  $pid = isset($form_values['pid']) ? $form_values['pid'] : 0;
+function path_form_validate($form, &$form_state) {
+  $src = $form_state['values']['src'];
+  $dst = $form_state['values']['dst'];
+  $pid = isset($form_state['values']['pid']) ? $form_state['values']['pid'] : 0;
   // Language is only set if locale module is enabled, otherwise save for all languages.
-  $language = isset($form_values['language']) ? $form_values['language'] : '';
+  $language = isset($form_state['values']['language']) ? $form_state['values']['language'] : '';
 
   if (db_result(db_query("SELECT COUNT(dst) FROM {url_alias} WHERE pid != %d AND dst = '%s' AND language = '%s'", $pid, $dst, $language))) {
     form_set_error('dst', t('The alias %alias is already in use in this language.', array('%alias' => $dst)));
@@ -382,9 +382,9 @@ function path_form_validate($form, &$form_state, $form_values) {
 /**
  * Save a new URL alias to the database.
  */
-function path_form_submit($form, &$form_state, $form_values) {
+function path_form_submit($form, &$form_state) {
   // Language is only set if locale module is enabled
-  path_set_alias($form_values['src'], $form_values['dst'], isset($form_values['pid']) ? $form_values['pid'] : 0, isset($form_values['language']) ? $form_values['language'] : '');
+  path_set_alias($form_state['values']['src'], $form_state['values']['dst'], isset($form_state['values']['pid']) ? $form_state['values']['pid'] : 0, isset($form_state['values']['language']) ? $form_state['values']['language'] : '');
 
   drupal_set_message(t('The alias has been saved.'));
   $form_state['redirect'] = 'admin/build/path';
@@ -394,7 +394,7 @@ function path_form_submit($form, &$form_state, $form_values) {
 /**
  * Return a form to filter URL aliases.
  */
-function path_admin_filter_form($keys = '') {
+function path_admin_filter_form(&$form_state, $keys = '') {
   $form['#attributes'] = array('class' => 'search-form');
   $form['basic'] = array('#type' => 'fieldset',
     '#title' => t('Filter aliases')
@@ -415,8 +415,8 @@ function path_admin_filter_form($keys = '') {
 /**
  * Process filter form submission.
  */
-function path_admin_filter_form_submit($form_id, $form_values) {
-  return 'admin/build/path/list/'. trim($form_values['filter']);
+function path_admin_filter_form_submit($form, &$form_state) {
+  return 'admin/build/path/list/'. trim($form_state['values']['filter']);
 }
 
 /**
@@ -427,4 +427,3 @@ function path_admin_filter_get_keys() {
   $path = explode('/', $_GET['q'], 5);
   return count($path) == 5 ? $path[4] : '';
 }
-
diff --git a/modules/poll/poll.module b/modules/poll/poll.module
index 396a845ce29cf22c3772d22a2bc916e9f9c4d7b7..7350fb0a1375a78bd0e0cf39a728b569aae3b775 100644
--- a/modules/poll/poll.module
+++ b/modules/poll/poll.module
@@ -99,12 +99,12 @@ function poll_delete($node) {
 /**
  * Implementation of hook_submit().
  */
-function poll_node_form_submit(&$form, &$form_state, $form_values) {
+function poll_node_form_submit(&$form, &$form_state) {
   // Renumber fields
-  $form_values['choice'] = array_values($form_values['choice']);
-  $form_values['teaser'] = poll_teaser((object)$form_values);
-  $form_state['choices'] = $form_values['choices'];
-  if ($form_values['morechoices']) {
+  $form_state['values']['choice'] = array_values($form_state['values']['choice']);
+  $form_state['values']['teaser'] = poll_teaser((object)$form_state['values']);
+  $form_state['choices'] = $form_state['values']['choices'];
+  if ($form_state['values']['morechoices']) {
     $form_state['choices'] *= 2;
   }
 }
@@ -136,7 +136,7 @@ function poll_validate($node) {
 /**
  * Implementation of hook_form().
  */
-function poll_form($node, $form_state = NULL) {
+function poll_form(&$node, $form_state) {
   $admin = user_access('administer nodes');
   $type = node_get_types('type', $node);
   $form['title'] = array(
@@ -170,7 +170,7 @@ function poll_form($node, $form_state = NULL) {
 
   // We'll manually set the #parents property of this checkbox so that
   // it appears in the fieldset visually, but its value won't pollute
-  // the $form_values['choice'] array.
+  // the $form_state['values']['choice'] array.
   $form['choice']['morechoices'] = array(
     '#type' => 'checkbox',
     '#parents' => array('morechoices'),
@@ -220,7 +220,6 @@ function poll_form($node, $form_state = NULL) {
     '#description' => t('After this period, the poll will be closed automatically.'),
   );
 
-  $form['#multistep'] = TRUE;
   return $form;
 }
 
@@ -454,7 +453,7 @@ function theme_poll_results($title, $results, $votes, $links, $block, $nid, $vot
   return $output;
 }
 
-function poll_cancel_form($nid) {
+function poll_cancel_form(&$form_state, $nid) {
   $form['#action'] = url("poll/cancel/$nid");
   $form['submit'] = array('#type' => 'submit', '#value' => t('Cancel your vote'));
   return $form;
diff --git a/modules/profile/profile.module b/modules/profile/profile.module
index bb32b15bcc321d669767d82c933d177212fe5b4e..0c49d69df148b481cbecc0210652a789a8b2feac 100644
--- a/modules/profile/profile.module
+++ b/modules/profile/profile.module
@@ -207,7 +207,7 @@ function profile_user($type, &$edit, &$user, $category = NULL) {
 /**
  * Menu callback: Generate a form to add/edit a user profile field.
  */
-function profile_field_form($arg = NULL) {
+function profile_field_form(&$form_state, $arg = NULL) {
   if (arg(3) == 'edit') {
     if (is_numeric($arg)) {
       $fid = $arg;
@@ -331,28 +331,28 @@ function profile_field_form($arg = NULL) {
 /**
  * Validate profile_field_form submissions.
  */
-function profile_field_form_validate($form, &$form_state, $form_values) {
+function profile_field_form_validate($form, &$form_state) {
   // Validate the 'field name':
-  if (preg_match('/[^a-zA-Z0-9_-]/', $form_values['name'])) {
+  if (preg_match('/[^a-zA-Z0-9_-]/', $form_state['values']['name'])) {
     form_set_error('name', t('The specified form name contains one or more illegal characters. Spaces or any other special characters except dash (-) and underscore (_) are not allowed.'));
   }
 
-  if (in_array($form_values['name'], user_fields())) {
+  if (in_array($form_state['values']['name'], user_fields())) {
     form_set_error('name', t('The specified form name is reserved for use by Drupal.'));
   }
   // Validate the category:
-  if (!$form_values['category']) {
+  if (!$form_state['values']['category']) {
     form_set_error('category', t('You must enter a category.'));
   }
-  if ($form_values['category'] == 'account') {
+  if ($form_state['values']['category'] == 'account') {
     form_set_error('category', t('The specified category name is reserved for use by Drupal.'));
   }
-  $args1 = array($form_values['title'], $form_values['category']);
-  $args2 = array($form_values['name']);
+  $args1 = array($form_state['values']['title'], $form_state['values']['category']);
+  $args2 = array($form_state['values']['name']);
   $query_suffix = '';
 
-  if (isset($form_values['fid'])) {
-    $args1[] = $args2[] = $form_values['fid'];
+  if (isset($form_state['values']['fid'])) {
+    $args1[] = $args2[] = $form_state['values']['fid'];
     $query_suffix = ' AND fid != %d';
   }
 
@@ -367,15 +367,15 @@ function profile_field_form_validate($form, &$form_state, $form_values) {
 /**
  * Process profile_field_form submissions.
  */
-function profile_field_form_submit($form, &$form_state, $form_values) {
-  if (!isset($form_values['fid'])) {
-    db_query("INSERT INTO {profile_fields} (title, name, explanation, category, type, weight, required, register, visibility, autocomplete, options, page) VALUES ('%s', '%s', '%s', '%s', '%s', %d, %d, %d, %d, %d, '%s', '%s')", $form_values['title'], $form_values['name'], $form_values['explanation'], $form_values['category'], $form_values['type'], $form_values['weight'], $form_values['required'], $form_values['register'], $form_values['visibility'], $form_values['autocomplete'], $form_values['options'], $form_values['page']);
+function profile_field_form_submit($form, &$form_state) {
+  if (!isset($form_state['values']['fid'])) {
+    db_query("INSERT INTO {profile_fields} (title, name, explanation, category, type, weight, required, register, visibility, autocomplete, options, page) VALUES ('%s', '%s', '%s', '%s', '%s', %d, %d, %d, %d, %d, '%s', '%s')", $form_state['values']['title'], $form_state['values']['name'], $form_state['values']['explanation'], $form_state['values']['category'], $form_state['values']['type'], $form_state['values']['weight'], $form_state['values']['required'], $form_state['values']['register'], $form_state['values']['visibility'], $form_state['values']['autocomplete'], $form_state['values']['options'], $form_state['values']['page']);
 
     drupal_set_message(t('The field has been created.'));
-    watchdog('profile', 'Profile field %field added under category %category.', array('%field' => $form_values['title'], '%category' => $form_values['category']), WATCHDOG_NOTICE, l(t('view'), 'admin/user/profile'));
+    watchdog('profile', 'Profile field %field added under category %category.', array('%field' => $form_state['values']['title'], '%category' => $form_state['values']['category']), WATCHDOG_NOTICE, l(t('view'), 'admin/user/profile'));
   }
   else {
-    db_query("UPDATE {profile_fields} SET title = '%s', name = '%s', explanation = '%s', category = '%s', weight = %d, required = %d, register = %d, visibility = %d, autocomplete = %d, options = '%s', page = '%s' WHERE fid = %d", $form_values['title'], $form_values['name'], $form_values['explanation'], $form_values['category'], $form_values['weight'], $form_values['required'], $form_values['register'], $form_values['visibility'], $form_values['autocomplete'], $form_values['options'], $form_values['page'], $form_values['fid']);
+    db_query("UPDATE {profile_fields} SET title = '%s', name = '%s', explanation = '%s', category = '%s', weight = %d, required = %d, register = %d, visibility = %d, autocomplete = %d, options = '%s', page = '%s' WHERE fid = %d", $form_state['values']['title'], $form_state['values']['name'], $form_state['values']['explanation'], $form_state['values']['category'], $form_state['values']['weight'], $form_state['values']['required'], $form_state['values']['register'], $form_state['values']['visibility'], $form_state['values']['autocomplete'], $form_state['values']['options'], $form_state['values']['page'], $form_state['values']['fid']);
 
     drupal_set_message(t('The field has been updated.'));
   }
@@ -407,14 +407,14 @@ function profile_field_delete($fid) {
 /**
  * Process a field delete form submission.
  */
-function profile_field_delete_submit($form, &$form_state, $form_values) {
-  db_query('DELETE FROM {profile_fields} WHERE fid = %d', $form_values['fid']);
-  db_query('DELETE FROM {profile_values} WHERE fid = %d', $form_values['fid']);
+function profile_field_delete_submit($form, &$form_state) {
+  db_query('DELETE FROM {profile_fields} WHERE fid = %d', $form_state['values']['fid']);
+  db_query('DELETE FROM {profile_values} WHERE fid = %d', $form_state['values']['fid']);
 
   cache_clear_all();
 
-  drupal_set_message(t('The field %field has been deleted.', array('%field' => $form_values['title'])));
-  watchdog('profile', 'Profile field %field deleted.', array('%field' => $form_values['title']), WATCHDOG_NOTICE, l(t('view'), 'admin/user/profile'));
+  drupal_set_message(t('The field %field has been deleted.', array('%field' => $form_state['values']['title'])));
+  watchdog('profile', 'Profile field %field deleted.', array('%field' => $form_state['values']['title']), WATCHDOG_NOTICE, l(t('view'), 'admin/user/profile'));
 
   $form_state['redirect'] = 'admin/user/profile';
   return;
diff --git a/modules/search/search.module b/modules/search/search.module
index 6592ac99caeff638b93360e393dea7a8c240ef6a..ce3e8e8ac1d4f1b2b427279d07e880119a3d69d7 100644
--- a/modules/search/search.module
+++ b/modules/search/search.module
@@ -207,13 +207,13 @@ function _search_menu($name) {
 /**
  * Validate callback.
  */
-function search_admin_settings_validate($form, &$form_state, $form_values) {
-  if ($form_values['op'] == t('Re-index site')) {
+function search_admin_settings_validate($form, &$form_state) {
+  if ($form_state['values']['op'] == t('Re-index site')) {
     drupal_goto('admin/settings/search/wipe');
   }
   // If these settings change, the index needs to be rebuilt.
-  if ((variable_get('minimum_word_size', 3) != $form_values['minimum_word_size']) ||
-      (variable_get('overlap_cjk', TRUE) != $form_values['overlap_cjk'])) {
+  if ((variable_get('minimum_word_size', 3) != $form_state['values']['minimum_word_size']) ||
+      (variable_get('overlap_cjk', TRUE) != $form_state['values']['overlap_cjk'])) {
     drupal_set_message(t('The index will be rebuilt.'));
     search_wipe();
   }
@@ -1004,7 +1004,7 @@ function search_view($type = 'node') {
  * @return
  *   An HTML string containing the search form.
  */
-function search_form($action = '', $keys = '', $type = NULL, $prompt = NULL) {
+function search_form(&$form_state, $action = '', $keys = '', $type = NULL, $prompt = NULL) {
 
   // Add CSS
   drupal_add_css(drupal_get_path('module', 'search') .'/search.css', 'module', 'all', FALSE);
@@ -1044,21 +1044,21 @@ function search_form($action = '', $keys = '', $type = NULL, $prompt = NULL) {
  * search_form_validate() is used solely to set the 'processed_keys' form
  * value for the basic search form.
  */
-function search_form_validate($form, &$form_state, $form_values) {
-  form_set_value($form['basic']['inline']['processed_keys'], trim($form_values['keys']), $form_state);
+function search_form_validate($form, &$form_state) {
+  form_set_value($form['basic']['inline']['processed_keys'], trim($form_state['values']['keys']), $form_state);
 }
 
 /**
  * Process a search form submission.
  */
-function search_form_submit($form, &$form_state, $form_values) {
-  $keys = $form_values['processed_keys'];
+function search_form_submit($form, &$form_state) {
+  $keys = $form_state['values']['processed_keys'];
   if ($keys == '') {
     form_set_error('keys', t('Please enter some keywords.'));
     // Fall through to the drupal_goto() call.
   }
 
-  $type = $form_values['module'] ? $form_values['module'] : 'node';
+  $type = $form_state['values']['module'] ? $form_state['values']['module'] : 'node';
   $form_state['redirect'] = 'search/'. $type .'/'. $keys;
   return;
 }
@@ -1066,7 +1066,7 @@ function search_form_submit($form, &$form_state, $form_values) {
 /**
  * Output a search form for the search block and the theme's search box.
  */
-function search_box($form_id) {
+function search_box(&$form_state, $form_id) {
   // Use search_keys instead of keys to avoid ID conflicts with the search block.
   $form[$form_id .'_keys'] = array(
     '#type' => 'textfield',
@@ -1088,9 +1088,9 @@ function search_box($form_id) {
 /**
  * Process a block search form submission.
  */
-function search_box_form_submit($form, &$form_state, $form_values) {
+function search_box_form_submit($form, &$form_state) {
   $form_id = $form['form_id']['#value'];
-  $form_state['redirect'] = 'search/node/'. trim($form_values[$form_id .'_keys']);
+  $form_state['redirect'] = 'search/node/'. trim($form_state['values'][$form_id .'_keys']);
   return;
 }
 
diff --git a/modules/system/system.module b/modules/system/system.module
index de953d1040b77dd996a3d878f92ce444ba06408b..36946e90284c3d04c72d92baa445b719ed4f4a81 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -350,7 +350,7 @@ function system_menu() {
 
 function system_init() {
   // Use the administrative theme if the user is looking at a page in the admin/* path.
-  if (arg(0) == 'admin') {
+  if (arg(0) == 'admin' || (variable_get('node_admin_theme', '0') && arg(0) == 'node' && (arg(1) == 'add' || arg(2) == 'edit'))) {
     global $custom_theme;
     $custom_theme = variable_get('admin_theme', '0');
     drupal_add_css(drupal_get_path('module', 'system') .'/admin.css', 'module');
@@ -440,17 +440,24 @@ function system_admin_theme_settings() {
     '#default_value' => variable_get('admin_theme', '0'),
   );
 
+  $form['node_admin_theme'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Use administration theme for content editing'),
+    '#description' => t('Use the administration theme when editing existing nodes or creating new ones..'),
+    '#default_value' => variable_get('node_admin_theme', '0'),
+  );
+
   $form['#submit'][] = 'system_admin_theme_submit';
   return system_settings_form($form);
 }
 
 
-function system_admin_theme_submit($form, &$form_state, $form_values) {
+function system_admin_theme_submit($form, &$form_state) {
   // If we're changing themes, make sure the theme has its blocks initialized.
-  if ($form_values['admin_theme'] != variable_get('admin_theme', '0')) {
-    $result = db_query("SELECT status FROM {blocks} WHERE theme = '%s'", $form_values['admin_theme']);
+  if ($form_state['values']['admin_theme'] != variable_get('admin_theme', '0')) {
+    $result = db_query("SELECT status FROM {blocks} WHERE theme = '%s'", $form_state['values']['admin_theme']);
     if (!db_num_rows($result)) {
-      system_initialize_theme_blocks($form_values['admin_theme']);
+      system_initialize_theme_blocks($form_state['values']['admin_theme']);
     }
   }
 }
@@ -467,7 +474,7 @@ function system_admin_theme_submit($form, &$form_state, $form_values) {
  * @return
  *    a form array
  */
-function system_theme_select_form($description = '', $default_value = '', $weight = 0) {
+function system_theme_select_form(&$form_state, $description = '', $default_value = '', $weight = 0) {
   if (user_access('select different theme')) {
     $enabled = array();
     $themes = list_themes();
@@ -955,17 +962,17 @@ function system_date_time_settings() {
   return $form;
 }
 
-function system_date_time_settings_submit($form, &$form_state, $form_values) {
-  if ($form_values['date_format_short'] == 'custom') {
-    $form_values['date_format_short'] = $form_values['date_format_short_custom'];
+function system_date_time_settings_submit($form, &$form_state) {
+  if ($form_state['values']['date_format_short'] == 'custom') {
+    $form_state['values']['date_format_short'] = $form_state['values']['date_format_short_custom'];
   }
-  if ($form_values['date_format_medium'] == 'custom') {
-    $form_values['date_format_medium'] = $form_values['date_format_medium_custom'];
+  if ($form_state['values']['date_format_medium'] == 'custom') {
+    $form_state['values']['date_format_medium'] = $form_state['values']['date_format_medium_custom'];
   }
-  if ($form_values['date_format_long'] == 'custom') {
-    $form_values['date_format_long'] = $form_values['date_format_long_custom'];
+  if ($form_state['values']['date_format_long'] == 'custom') {
+    $form_state['values']['date_format_long'] = $form_state['values']['date_format_long_custom'];
   }
-  return system_settings_form_submit($form_values, $form, $form_state);
+  return system_settings_form_submit($form_state['values'], $form, $form_state);
 }
 
 /**
@@ -1250,19 +1257,19 @@ function system_settings_form($form) {
   return $form;
 }
 
-function system_theme_settings_submit($form, &$form_state, $form_values) {
+function system_theme_settings_submit($form, &$form_state) {
   $op = isset($_POST['op']) ? $_POST['op'] : '';
-  $key = $form_values['var'];
+  $key = $form_state['values']['var'];
 
   // Exclude unnecessary elements.
-  unset($form_values['var'], $form_values['submit'], $form_values['reset'], $form_values['form_id']);
+  unset($form_state['values']['var'], $form_state['values']['submit'], $form_state['values']['reset'], $form_state['values']['form_id']);
 
   if ($op == t('Reset to defaults')) {
     variable_del($key);
     drupal_set_message(t('The configuration options have been reset to their default values.'));
   }
   else {
-    variable_set($key, $form_values);
+    variable_set($key, $form_state['values']);
     drupal_set_message(t('The configuration options have been saved.'));
   }
 
@@ -1276,18 +1283,18 @@ function system_theme_settings_submit($form, &$form_state, $form_values) {
  * add an array_filter value to your form.
  *
  */
-function system_settings_form_submit($form, &$form_state, $form_values) {
-  $op = isset($form_values['op']) ? $form_values['op'] : '';
+function system_settings_form_submit($form, &$form_state) {
+  $op = isset($form_state['values']['op']) ? $form_state['values']['op'] : '';
 
   // Exclude unnecessary elements.
-  unset($form_values['submit'], $form_values['reset'], $form_values['form_id'], $form_values['op'], $form_values['form_token']);
+  unset($form_state['values']['submit'], $form_state['values']['reset'], $form_state['values']['form_id'], $form_state['values']['op'], $form_state['values']['form_token']);
 
-  foreach ($form_values as $key => $value) {
+  foreach ($form_state['values'] as $key => $value) {
     if ($op == t('Reset to defaults')) {
       variable_del($key);
     }
     else {
-      if (is_array($value) && isset($form_values['array_filter'])) {
+      if (is_array($value) && isset($form_state['values']['array_filter'])) {
         $value = array_keys(array_filter($value));
       }
       variable_set($key, $value);
@@ -1381,7 +1388,7 @@ function theme_system_themes_form($form) {
 }
 
 
-function system_themes_form_submit($form, &$form_state, $form_values) {
+function system_themes_form_submit($form, &$form_state) {
 
   // Store list of previously enabled themes and disable all themes
   $old_theme_list = $new_theme_list = array();
@@ -1392,25 +1399,25 @@ function system_themes_form_submit($form, &$form_state, $form_values) {
   }
   db_query("UPDATE {system} SET status = 0 WHERE type = 'theme'");
 
-  if ($form_values['op'] == t('Save configuration')) {
-    if (is_array($form_values['status'])) {
-      foreach ($form_values['status'] as $key => $choice) {
+  if ($form_state['values']['op'] == t('Save configuration')) {
+    if (is_array($form_state['values']['status'])) {
+      foreach ($form_state['values']['status'] as $key => $choice) {
         // Always enable the default theme, despite its status checkbox being checked:
-        if ($choice || $form_values['theme_default'] == $key) {
+        if ($choice || $form_state['values']['theme_default'] == $key) {
           system_initialize_theme_blocks($key);
           $new_theme_list[] = $key;
           db_query("UPDATE {system} SET status = 1 WHERE type = 'theme' and name = '%s'", $key);
         }
       }
     }
-    if (($admin_theme = variable_get('admin_theme', '0')) != '0' && $admin_theme != $form_values['theme_default']) {
+    if (($admin_theme = variable_get('admin_theme', '0')) != '0' && $admin_theme != $form_state['values']['theme_default']) {
       drupal_set_message(t('Please note that the <a href="!admin_theme_page">administration theme</a> is still set to the %admin_theme theme; consequently, the theme on this page remains unchanged. All non-administrative sections of the site, however, will show the selected %selected_theme theme by default.', array(
         '!admin_theme_page' => url('admin/settings/admin'),
         '%admin_theme' => $admin_theme,
-        '%selected_theme' => $form_values['theme_default'],
+        '%selected_theme' => $form_state['values']['theme_default'],
       )));
     }
-    variable_set('theme_default', $form_values['theme_default']);
+    variable_set('theme_default', $form_state['values']['theme_default']);
   }
   else {
     // Revert to defaults: only Garland is enabled.
@@ -1657,7 +1664,7 @@ function system_module_build_dependencies($modules, $form_values) {
 /**
  * Submit callback; handles modules form submission.
  */
-function system_modules_submit($form, &$form_state, $form_values) {
+function system_modules_submit($form, &$form_state) {
   include_once './includes/install.inc';
   $new_modules = array();
 
@@ -1666,13 +1673,13 @@ function system_modules_submit($form, &$form_state, $form_values) {
     // Merge in disabled active modules since they should be enabled.
     // They don't appear because disabled checkboxes are not submitted
     // by browsers.
-    $form_values['status'] = array_merge($form_values['status'], $form_values['disabled_modules']);
+    $form_state['values']['status'] = array_merge($form_state['values']['status'], $form_state['values']['disabled_modules']);
 
     // Check values for dependency that we can't install.
-    if ($dependencies = system_module_build_dependencies($form_values['validation_modules'], $form_values)) {
+    if ($dependencies = system_module_build_dependencies($form_state['values']['validation_modules'], $form_state['values'])) {
       // These are the modules that depend on existing modules.
       foreach (array_keys($dependencies) as $name) {
-        $form_values['status'][$name] = 0;
+        $form_state['values']['status'][$name] = 0;
       }
     }
   }
@@ -1681,8 +1688,8 @@ function system_modules_submit($form, &$form_state, $form_values) {
   }
 
   // Update throttle settings, if present
-  if (isset($form_values['throttle'])) {
-    foreach ($form_values['throttle'] as $key => $choice) {
+  if (isset($form_state['values']['throttle'])) {
+    foreach ($form_state['values']['throttle'] as $key => $choice) {
       db_query("UPDATE {system} SET throttle = %d WHERE type = 'module' and name = '%s'", $choice ? 1 : 0, $key);
     }
   }
@@ -1690,12 +1697,12 @@ function system_modules_submit($form, &$form_state, $form_values) {
   // If there where unmet dependencies and they haven't confirmed don't process
   // the submission yet. Store the form submission data needed later.
   if ($dependencies) {
-    if (!isset($form_values['confirm'])) {
-      $form_state['storage'] = array($dependencies, $form_values['status']);
+    if (!isset($form_state['values']['confirm'])) {
+      $form_state['storage'] = array($dependencies, $form_state['values']['status']);
       return;
     }
     else {
-      $form_values['status'] = array_merge($form_values['status'], $form_storage[1]);
+      $form_state['values']['status'] = array_merge($form_state['values']['status'], $form_storage[1]);
     }
   }
   // If we have no dependencies, or the dependencies are confirmed
@@ -1704,7 +1711,7 @@ function system_modules_submit($form, &$form_state, $form_values) {
 
   $enable_modules = array();
   $disable_modules = array();
-  foreach ($form_values['status'] as $key => $choice) {
+  foreach ($form_state['values']['status'] as $key => $choice) {
     if ($choice) {
       if (drupal_get_installed_schema_version($key) == SCHEMA_UNINSTALLED) {
         $new_modules[] = $key;
@@ -1821,7 +1828,7 @@ function theme_system_modules($form) {
  * Builds a form of currently disabled modules.
  *
  * @param
- *   $form_values Submitted form values.
+ *   $form_state['values'] Submitted form values.
  * @return
  *   A form array representing the currently disabled modules.
  */
@@ -1876,7 +1883,7 @@ function system_modules_uninstall($form_state = NULL) {
  * Confirm uninstall of selected modules.
  *
  * @param
- *   $form_values Submitted form values.
+ *   $form_state['values'] Submitted form values.
  * @return
  *   A form array representing modules to confirm.
  */
@@ -1958,11 +1965,11 @@ function theme_system_modules_uninstall($form) {
  * @param
  *   $form_id The form ID.
  * @param
- *   $form_values Submitted form values.
+ *   $form_state['values'] Submitted form values.
  */
-function system_modules_uninstall_validate($form, &$form_state, $form_values) {
+function system_modules_uninstall_validate($form, &$form_state) {
   // Form submitted, but no modules selected.
-  if (!count(array_filter($form_values['uninstall']))) {
+  if (!count(array_filter($form_state['values']['uninstall']))) {
     drupal_set_message(t('No modules selected.'), 'error');
     drupal_goto('admin/build/modules/uninstall');
   }
@@ -1974,15 +1981,15 @@ function system_modules_uninstall_validate($form, &$form_state, $form_values) {
  * @param
  *   $form_id The form ID.
  * @param
- *   $form_values Submitted form values.
+ *   $form_state['values'] Submitted form values.
  */
-function system_modules_uninstall_submit($form, &$form_state, $form_values) {
+function system_modules_uninstall_submit($form, &$form_state) {
   // Make sure the install API is available.
   include_once './includes/install.inc';
 
   if (!empty($form['#confirmed'])) {
     // Call the uninstall routine for each selected module.
-    foreach (array_filter($form_values['uninstall']) as $module => $value) {
+    foreach (array_filter($form_state['values']['uninstall']) as $module => $value) {
       drupal_uninstall_module($module);
     }
     drupal_set_message(t('The selected modules have been uninstalled.'));
@@ -1991,7 +1998,7 @@ function system_modules_uninstall_submit($form, &$form_state, $form_values) {
     $form_state['redirect'] = 'admin/build/modules/uninstall';
   }
   else {
-    $form_state['storage'] = $form_values;
+    $form_state['storage'] = $form_state['values'];
   }
 }
 
@@ -2166,7 +2173,7 @@ function system_logging_overview() {
 /**
  * Menu callback; display theme configuration for entire site and individual themes.
  */
-function system_theme_settings($key = '') {
+function system_theme_settings(&$form_state, $key = '') {
   $directory_path = file_directory_path();
   file_check_directory($directory_path, FILE_CREATE_DIRECTORY, 'file_directory_path');
 
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module
index d86502782cb5324f508be62c14df600242611655..70a6d3881178b642ab60f7945480c5bffe18671c 100644
--- a/modules/taxonomy/taxonomy.module
+++ b/modules/taxonomy/taxonomy.module
@@ -304,21 +304,21 @@ function taxonomy_form_vocabulary($edit = array()) {
 /**
  * Accept the form submission for a vocabulary and save the results.
  */
-function taxonomy_form_vocabulary_submit($form, &$form_state, $form_values) {
+function taxonomy_form_vocabulary_submit($form, &$form_state) {
   // Fix up the nodes array to remove unchecked nodes.
-  $form_values['nodes'] = array_filter($form_values['nodes']);
-  switch (taxonomy_save_vocabulary($form_values)) {
+  $form_state['values']['nodes'] = array_filter($form_state['values']['nodes']);
+  switch (taxonomy_save_vocabulary($form_state['values'])) {
     case SAVED_NEW:
-      drupal_set_message(t('Created new vocabulary %name.', array('%name' => $form_values['name'])));
-      watchdog('taxonomy', 'Created new vocabulary %name.', array('%name' => $form_values['name']), WATCHDOG_NOTICE, l(t('edit'), 'admin/content/taxonomy/edit/vocabulary/'. $form_values['vid']));
+      drupal_set_message(t('Created new vocabulary %name.', array('%name' => $form_state['values']['name'])));
+      watchdog('taxonomy', 'Created new vocabulary %name.', array('%name' => $form_state['values']['name']), WATCHDOG_NOTICE, l(t('edit'), 'admin/content/taxonomy/edit/vocabulary/'. $form_state['values']['vid']));
       break;
     case SAVED_UPDATED:
-      drupal_set_message(t('Updated vocabulary %name.', array('%name' => $form_values['name'])));
-      watchdog('taxonomy', 'Updated vocabulary %name.', array('%name' => $form_values['name']), WATCHDOG_NOTICE, l(t('edit'), 'admin/content/taxonomy/edit/vocabulary/'. $form_values['vid']));
+      drupal_set_message(t('Updated vocabulary %name.', array('%name' => $form_state['values']['name'])));
+      watchdog('taxonomy', 'Updated vocabulary %name.', array('%name' => $form_state['values']['name']), WATCHDOG_NOTICE, l(t('edit'), 'admin/content/taxonomy/edit/vocabulary/'. $form_state['values']['vid']));
       break;
   }
 
-  $form_state['vid'] = $form_values['vid'];
+  $form_state['vid'] = $form_state['values']['vid'];
   $form_state['redirect'] = 'admin/content/taxonomy';
   return;
 }
@@ -393,10 +393,10 @@ function taxonomy_vocabulary_confirm_delete($vid) {
                   t('Cancel'));
 }
 
-function taxonomy_vocabulary_confirm_delete_submit($form, &$form_state, $form_values) {
-  $status = taxonomy_del_vocabulary($form_values['vid']);
-  drupal_set_message(t('Deleted vocabulary %name.', array('%name' => $form_values['name'])));
-  watchdog('taxonomy', 'Deleted vocabulary %name.', array('%name' => $form_values['name']), WATCHDOG_NOTICE);
+function taxonomy_vocabulary_confirm_delete_submit($form, &$form_state) {
+  $status = taxonomy_del_vocabulary($form_state['values']['vid']);
+  drupal_set_message(t('Deleted vocabulary %name.', array('%name' => $form_state['values']['name'])));
+  watchdog('taxonomy', 'Deleted vocabulary %name.', array('%name' => $form_state['values']['name']), WATCHDOG_NOTICE);
   $form_state['redirect'] = 'admin/content/taxonomy';
   return;
 }
@@ -479,19 +479,19 @@ function taxonomy_form_term($vocabulary, $edit = array()) {
 /**
  * Accept the form submission for a taxonomy term and save the result.
  */
-function taxonomy_form_term_submit($form, &$form_state, $form_values) {
-  switch (taxonomy_save_term($form_values)) {
+function taxonomy_form_term_submit($form, &$form_state) {
+  switch (taxonomy_save_term($form_state['values'])) {
     case SAVED_NEW:
-      drupal_set_message(t('Created new term %term.', array('%term' => $form_values['name'])));
-      watchdog('taxonomy', 'Created new term %term.', array('%term' => $form_values['name']), WATCHDOG_NOTICE, l(t('edit'), 'admin/content/taxonomy/edit/term/'. $form_values['tid']));
+      drupal_set_message(t('Created new term %term.', array('%term' => $form_state['values']['name'])));
+      watchdog('taxonomy', 'Created new term %term.', array('%term' => $form_state['values']['name']), WATCHDOG_NOTICE, l(t('edit'), 'admin/content/taxonomy/edit/term/'. $form_state['values']['tid']));
       break;
     case SAVED_UPDATED:
-      drupal_set_message(t('Updated term %term.', array('%term' => $form_values['name'])));
-      watchdog('taxonomy', 'Updated term %term.', array('%term' => $form_values['name']), WATCHDOG_NOTICE, l(t('edit'), 'admin/content/taxonomy/edit/term/'. $form_values['tid']));
+      drupal_set_message(t('Updated term %term.', array('%term' => $form_state['values']['name'])));
+      watchdog('taxonomy', 'Updated term %term.', array('%term' => $form_state['values']['name']), WATCHDOG_NOTICE, l(t('edit'), 'admin/content/taxonomy/edit/term/'. $form_state['values']['tid']));
       break;
   }
 
-  $form_state['tid'] = $form_values['tid'];
+  $form_state['tid'] = $form_state['values']['tid'];
   $form_state['redirect'] = 'admin/content/taxonomy';
   return;
 }
@@ -499,7 +499,7 @@ function taxonomy_form_term_submit($form, &$form_state, $form_values) {
 /**
  * Helper function for taxonomy_form_term_submit().
  *
- * @param $form_values
+ * @param $form_state['values']
  * @return
  *   Status constant indicating if term was inserted or updated.
  */
@@ -629,10 +629,10 @@ function taxonomy_term_confirm_delete($tid) {
                   t('Cancel'));
 }
 
-function taxonomy_term_confirm_delete_submit($form, &$form_state, $form_values) {
-  taxonomy_del_term($form_values['tid']);
-  drupal_set_message(t('Deleted term %name.', array('%name' => $form_values['name'])));
-  watchdog('taxonomy', 'Deleted term %name.', array('%name' => $form_values['name']), WATCHDOG_NOTICE);
+function taxonomy_term_confirm_delete_submit($form, &$form_state) {
+  taxonomy_del_term($form_state['values']['tid']);
+  drupal_set_message(t('Deleted term %name.', array('%name' => $form_state['values']['name'])));
+  watchdog('taxonomy', 'Deleted term %name.', array('%name' => $form_state['values']['name']), WATCHDOG_NOTICE);
   $form_state['redirect'] = 'admin/content/taxonomy';
   return;
 }
@@ -640,7 +640,7 @@ function taxonomy_term_confirm_delete_submit($form, &$form_state, $form_values)
 /**
  * Generate a form element for selecting terms from a vocabulary.
  */
-function taxonomy_form($vid, $value = 0, $help = NULL, $name = 'taxonomy') {
+function taxonomy_form(&$form_state, $vid, $value = 0, $help = NULL, $name = 'taxonomy') {
   $vocabulary = taxonomy_vocabulary_load($vid);
   $help = ($help) ? $help : $vocabulary->help;
   if ($vocabulary->required) {
diff --git a/modules/throttle/throttle.module b/modules/throttle/throttle.module
index e1e4b630d02a32703d67fbcd660362eacc80a0f3..a236142107d718abf3d3da369f6121de8e14f70f 100644
--- a/modules/throttle/throttle.module
+++ b/modules/throttle/throttle.module
@@ -156,11 +156,11 @@ function throttle_admin_settings() {
   return system_settings_form($form);
 }
 
-function throttle_admin_settings_validate($form, &$form_state, $form_values) {
-  if (!is_numeric($form_values['throttle_anonymous']) || $form_values['throttle_anonymous'] < 0) {
-    form_set_error('throttle_anonymous', t("%value is not a valid auto-throttle setting. Please enter a positive numeric value.", array('%value' => $form_values['throttle_anonymous'])));
+function throttle_admin_settings_validate($form, &$form_state) {
+  if (!is_numeric($form_state['values']['throttle_anonymous']) || $form_state['values']['throttle_anonymous'] < 0) {
+    form_set_error('throttle_anonymous', t("%value is not a valid auto-throttle setting. Please enter a positive numeric value.", array('%value' => $form_state['values']['throttle_anonymous'])));
   }
-  if (!is_numeric($form_values['throttle_user']) || $form_values['throttle_user'] < 0) {
-    form_set_error('throttle_user', t("%value is not a valid auto-throttle setting. Please enter a positive numeric value.", array('%value' => $form_values['throttle_user'])));
+  if (!is_numeric($form_state['values']['throttle_user']) || $form_state['values']['throttle_user'] < 0) {
+    form_set_error('throttle_user', t("%value is not a valid auto-throttle setting. Please enter a positive numeric value.", array('%value' => $form_state['values']['throttle_user'])));
   }
 }
diff --git a/modules/upload/upload.module b/modules/upload/upload.module
index c0b7685d1afc515ecfa0754eb7a1e2c01c8935b7..b56dfa57b12571fb38b65fde571a141b63271d00 100644
--- a/modules/upload/upload.module
+++ b/modules/upload/upload.module
@@ -100,15 +100,15 @@ function upload_menu_alter(&$items) {
 /**
  * Form API callback to validate the upload settings form.
  */
-function upload_admin_settings_validate($form, &$form_state, $form_values) {
-  if (($form_values['upload_max_resolution'] != '0')) {
-    if (!preg_match('/^[0-9]+x[0-9]+$/', $form_values['upload_max_resolution'])) {
+function upload_admin_settings_validate($form, &$form_state) {
+  if (($form_state['values']['upload_max_resolution'] != '0')) {
+    if (!preg_match('/^[0-9]+x[0-9]+$/', $form_state['values']['upload_max_resolution'])) {
       form_set_error('upload_max_resolution', t('The maximum allowed image size expressed as WIDTHxHEIGHT (e.g. 640x480). Set to 0 for no restriction.'));
     }
   }
 
-  $default_uploadsize = $form_values['upload_uploadsize_default'];
-  $default_usersize = $form_values['upload_usersize_default'];
+  $default_uploadsize = $form_state['values']['upload_uploadsize_default'];
+  $default_usersize = $form_state['values']['upload_usersize_default'];
 
   $exceed_max_msg = t('Your PHP settings limit the maximum file size per upload to %size MB.', array('%size' => file_upload_max_size())) .'<br/>';
   $more_info = t("Depending on your sever environment, these settings may be changed in the system-wide php.ini file, a php.ini file in your Drupal root directory, in your Drupal site's settings.php file, or in the .htaccess file in your Drupal root directory.");
@@ -127,9 +127,9 @@ function upload_admin_settings_validate($form, &$form_state, $form_values) {
     form_set_error('upload_uploadsize_default', t('The %role maximum file size per upload is greater than the total file size allowed per user', array('%role' => t('default'))));
   }
 
-  foreach ($form_values['roles'] as $rid => $role) {
-    $uploadsize = $form_values['upload_uploadsize_'. $rid];
-    $usersize = $form_values['upload_usersize_'. $rid];
+  foreach ($form_state['values']['roles'] as $rid => $role) {
+    $uploadsize = $form_state['values']['upload_uploadsize_'. $rid];
+    $usersize = $form_state['values']['upload_usersize_'. $rid];
 
     if (!is_numeric($uploadsize) || ($uploadsize <= 0)) {
       form_set_error('upload_uploadsize_'. $rid, t('The %role file size limit must be a number and greater than zero.', array('%role' => $role)));
diff --git a/modules/user/user.module b/modules/user/user.module
index 72bbb1e34651f5eed40e20a1d67f3972314184fe..abf607c3521bb59250cbc6ed96a684828a6fb719 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -318,7 +318,7 @@ function user_validate_mail($mail) {
   }
 }
 
-function user_validate_picture(&$form, &$form_state, $form_values) {
+function user_validate_picture(&$form, &$form_state) {
   // If required, validate the uploaded picture.
   $validators = array(
     'file_validate_is_image' => array(),
@@ -332,7 +332,7 @@ function user_validate_picture(&$form, &$form_state, $form_values) {
     $info = image_get_info($file->filepath);
     $destination = variable_get('user_picture_path', 'pictures') .'/picture-'. $form['#uid'] .'.'. $info['extension'];
     if (file_copy($file, $destination, FILE_EXISTS_REPLACE)) {
-      $form_values['picture'] = $file->filepath;
+      $form_state['values']['picture'] = $file->filepath;
     }
     else {
       form_set_error('picture_upload', t("Failed to upload the picture image; the %directory directory doesn't exist or is not writable.", array('%directory' => variable_get('user_picture_path', 'pictures'))));
@@ -496,7 +496,8 @@ function user_user($type, &$edit, &$user, $category = NULL) {
     return array(t('History') => $items);
   }
   if ($type == 'form' && $category == 'account') {
-    return user_edit_form(arg(1), $edit);
+    $form_state = array();
+    return user_edit_form($form_state, arg(1), $edit);
   }
 
   if ($type == 'validate' && $category == 'account') {
@@ -1056,28 +1057,28 @@ function user_login($msg = '') {
   return $form;
 }
 
-function user_login_validate($form, &$form_state, $form_values) {
-  if ($form_values['name']) {
-    if (user_is_blocked($form_values['name'])) {
+function user_login_validate($form, &$form_state) {
+  if ($form_state['values']['name']) {
+    if (user_is_blocked($form_state['values']['name'])) {
       // blocked in user administration
-      form_set_error('name', t('The username %name has not been activated or is blocked.', array('%name' => $form_values['name'])));
+      form_set_error('name', t('The username %name has not been activated or is blocked.', array('%name' => $form_state['values']['name'])));
     }
-    else if (drupal_is_denied('user', $form_values['name'])) {
+    else if (drupal_is_denied('user', $form_state['values']['name'])) {
       // denied by access controls
-      form_set_error('name', t('The name %name is a reserved username.', array('%name' => $form_values['name'])));
+      form_set_error('name', t('The name %name is a reserved username.', array('%name' => $form_state['values']['name'])));
     }
-    else if ($form_values['pass']) {
-      $user = user_authenticate($form_values['name'], trim($form_values['pass']));
+    else if ($form_state['values']['pass']) {
+      $user = user_authenticate($form_state['values']['name'], trim($form_state['values']['pass']));
 
       if (!$user->uid) {
         form_set_error('name', t('Sorry, unrecognized username or password. <a href="@password">Have you forgotten your password?</a>', array('@password' => url('user/password'))));
-        watchdog('user', 'Login attempt failed for %user.', array('%user' => $form_values['name']));
+        watchdog('user', 'Login attempt failed for %user.', array('%user' => $form_state['values']['name']));
       }
     }
   }
 }
 
-function user_login_submit($form, &$form_state, $form_values) {
+function user_login_submit($form, &$form_state) {
   global $user;
   if ($user->uid) {
     watchdog('user', 'Session opened for %name.', array('%name' => $user->name));
@@ -1085,7 +1086,7 @@ function user_login_submit($form, &$form_state, $form_values) {
     // Update the user table timestamp noting user has logged in.
     db_query("UPDATE {users} SET login = %d WHERE uid = %d", time(), $user->uid);
 
-    user_module_invoke('login', $form_values, $user);
+    user_module_invoke('login', $form_state['values'], $user);
 
     sess_regenerate();
     $form_state['redirect'] = 'user/'. $user->uid;
@@ -1172,8 +1173,8 @@ function user_pass() {
   return $form;
 }
 
-function user_pass_validate($form, &$form_state, $form_values) {
-  $name = trim($form_values['name']);
+function user_pass_validate($form, &$form_state) {
+  $name = trim($form_state['values']['name']);
   if (valid_email_address($name)) {
     $account = user_load(array('mail' => $name, 'status' => 1));
   }
@@ -1188,8 +1189,8 @@ function user_pass_validate($form, &$form_state, $form_values) {
   }
 }
 
-function user_pass_submit($form, &$form_state, $form_values) {
-  $account = $form_values['account'];
+function user_pass_submit($form, &$form_state) {
+  $account = $form_state['values']['account'];
   // Mail one time login URL and instructions.
   $mail_success = _user_mail_notify('password_reset', $account);
   if ($mail_success) {
@@ -1293,7 +1294,7 @@ function user_register() {
     $form['affiliates'] = array('#value' => '<p>'. t('Note: if you have an account with one of our affiliates (!s), you may <a href="@login_uri">login now</a> instead of registering.', array('!s' => $affiliates, '@login_uri' => url('user'))) .'</p>');
   }
   // Merge in the default user edit fields.
-  $form = array_merge($form, user_edit_form(NULL, NULL, TRUE));
+  $form = array_merge($form, user_edit_form($form_state, NULL, NULL, TRUE));
   if ($admin) {
     $form['account']['notify'] = array(
      '#type' => 'checkbox',
@@ -1325,45 +1326,45 @@ function user_register() {
   return $form;
 }
 
-function user_register_validate($form, &$form_state, $form_values) {
-  user_module_invoke('validate', $form_values, $form_values, 'account');
+function user_register_validate($form, &$form_state) {
+  user_module_invoke('validate', $form_state['values'], $form_state['values'], 'account');
 }
 
-function user_register_submit($form, &$form_state, $form_values) {
+function user_register_submit($form, &$form_state) {
   global $base_url;
   $admin = user_access('administer users');
 
-  $mail = $form_values['mail'];
-  $name = $form_values['name'];
+  $mail = $form_state['values']['mail'];
+  $name = $form_state['values']['name'];
   if (!variable_get('user_email_verification', TRUE) || $admin) {
-    $pass = $form_values['pass'];
+    $pass = $form_state['values']['pass'];
   }
   else {
     $pass = user_password();
   };
-  $notify = isset($form_values['notify']) ? $form_values['notify'] : NULL;
+  $notify = isset($form_state['values']['notify']) ? $form_state['values']['notify'] : NULL;
   $from = variable_get('site_mail', ini_get('sendmail_from'));
-  if (isset($form_values['roles'])) {
-    $roles = array_filter($form_values['roles']);     // Remove unset roles
+  if (isset($form_state['values']['roles'])) {
+    $roles = array_filter($form_state['values']['roles']);     // Remove unset roles
   }
   else {
     $roles = array();
   }
 
-  if (!$admin && array_intersect(array_keys($form_values), array('uid', 'roles', 'init', 'session', 'status'))) {
+  if (!$admin && array_intersect(array_keys($form_state['values']), array('uid', 'roles', 'init', 'session', 'status'))) {
     watchdog('security', 'Detected malicious attempt to alter protected user fields.', array(), WATCHDOG_WARNING);
     $form_state['redirect'] = 'user/register';
     return;
   }
   //the unset below is needed to prevent these form values from being saved as user data
-  unset($form_values['form_token'], $form_values['submit'], $form_values['op'], $form_values['notify'], $form_values['form_id'], $form_values['affiliates'], $form_values['destination']);
+  unset($form_state['values']['form_token'], $form_state['values']['submit'], $form_state['values']['op'], $form_state['values']['notify'], $form_state['values']['form_id'], $form_state['values']['affiliates'], $form_state['values']['destination']);
 
   $merge_data = array('pass' => $pass, 'init' => $mail, 'roles' => $roles);
   if (!$admin) {
     // Set the user's status because it was not displayed in the form.
     $merge_data['status'] = variable_get('user_register', 1) == 1;
   }
-  $account = user_save('', array_merge($form_values, $merge_data));
+  $account = user_save('', array_merge($form_state['values'], $merge_data));
   $form_state['user'] = $account;
 
   watchdog('user', 'New user: %name (%email).', array('%name' => $name, '%email' => $mail), WATCHDOG_NOTICE, l(t('edit'), 'user/'. $account->uid .'/edit'));
@@ -1413,7 +1414,7 @@ function user_register_submit($form, &$form_state, $form_values) {
   }
 }
 
-function user_edit_form($uid, $edit, $register = FALSE) {
+function user_edit_form(&$form_state, $uid, $edit, $register = FALSE) {
   $admin = user_access('administer users');
 
   // Account information:
@@ -1537,7 +1538,7 @@ function _user_edit_submit($uid, &$edit) {
   }
 }
 
-function user_edit($category = 'account') {
+function user_edit($form_state, $category = 'account') {
   global $user;
 
   $account = user_load(array('uid' => arg(1)));
@@ -1608,22 +1609,22 @@ function user_delete($edit, $uid) {
   module_invoke_all('user', 'delete', $edit, $account);
 }
 
-function user_edit_validate($form, &$form_state, $form_values) {
-  user_module_invoke('validate', $form_values, $form_values['_account'], $form_values['_category']);
+function user_edit_validate($form, &$form_state) {
+  user_module_invoke('validate', $form_state['values'], $form_state['values']['_account'], $form_state['values']['_category']);
   // Validate input to ensure that non-privileged users can't alter protected data.
-  if ((!user_access('administer users') && array_intersect(array_keys($form_values), array('uid', 'init', 'session'))) || (!user_access('administer access control') && isset($form_values['roles']))) {
+  if ((!user_access('administer users') && array_intersect(array_keys($form_state['values']), array('uid', 'init', 'session'))) || (!user_access('administer access control') && isset($form_state['values']['roles']))) {
     watchdog('security', 'Detected malicious attempt to alter protected user fields.', array(), WATCHDOG_WARNING);
     // set this to a value type field
     form_set_error('category', t('Detected malicious attempt to alter protected user fields.'));
   }
 }
 
-function user_edit_submit($form, &$form_state, $form_values) {
-  $account = $form_values['_account'];
-  $category = $form_values['_category'];
-  unset($form_values['_account'], $form_values['op'], $form_values['submit'], $form_values['delete'], $form_values['form_token'], $form_values['form_id'], $form_values['_category']);
-  user_module_invoke('submit', $form_values, $account, $category);
-  user_save($account, $form_values, $category);
+function user_edit_submit($form, &$form_state) {
+  $account = $form_state['values']['_account'];
+  $category = $form_state['values']['_category'];
+  unset($form_state['values']['_account'], $form_state['values']['op'], $form_state['values']['submit'], $form_state['values']['delete'], $form_state['values']['form_token'], $form_state['values']['form_id'], $form_state['values']['_category']);
+  user_module_invoke('submit', $form_state['values'], $account, $category);
+  user_save($account, $form_state['values'], $category);
 
   // Clear the page cache because pages can contain usernames and/or profile information:
   cache_clear_all();
@@ -1742,36 +1743,36 @@ function user_admin_access_check() {
   return $output;
 }
 
-function user_admin_access_check_validate($form, &$form_state, $form_values) {
-  if (empty($form_values['test'])) {
-    form_set_error($form_values['type'], t('No value entered. Please enter a test string and try again.'));
+function user_admin_access_check_validate($form, &$form_state) {
+  if (empty($form_state['values']['test'])) {
+    form_set_error($form_state['values']['type'], t('No value entered. Please enter a test string and try again.'));
   }
 }
 
-function user_admin_access_check_submit($form, &$form_state, $form_values) {
-  switch ($form_values['type']) {
+function user_admin_access_check_submit($form, &$form_state) {
+  switch ($form_state['values']['type']) {
     case 'user':
-      if (drupal_is_denied('user', $form_values['test'])) {
-        drupal_set_message(t('The username %name is not allowed.', array('%name' => $form_values['test'])));
+      if (drupal_is_denied('user', $form_state['values']['test'])) {
+        drupal_set_message(t('The username %name is not allowed.', array('%name' => $form_state['values']['test'])));
       }
       else {
-        drupal_set_message(t('The username %name is allowed.', array('%name' => $form_values['test'])));
+        drupal_set_message(t('The username %name is allowed.', array('%name' => $form_state['values']['test'])));
       }
       break;
     case 'mail':
-      if (drupal_is_denied('mail', $form_values['test'])) {
-        drupal_set_message(t('The e-mail address %mail is not allowed.', array('%mail' => $form_values['test'])));
+      if (drupal_is_denied('mail', $form_state['values']['test'])) {
+        drupal_set_message(t('The e-mail address %mail is not allowed.', array('%mail' => $form_state['values']['test'])));
       }
       else {
-        drupal_set_message(t('The e-mail address %mail is allowed.', array('%mail' => $form_values['test'])));
+        drupal_set_message(t('The e-mail address %mail is allowed.', array('%mail' => $form_state['values']['test'])));
       }
       break;
     case 'host':
-      if (drupal_is_denied('host', $form_values['test'])) {
-        drupal_set_message(t('The hostname %host is not allowed.', array('%host' => $form_values['test'])));
+      if (drupal_is_denied('host', $form_state['values']['test'])) {
+        drupal_set_message(t('The hostname %host is not allowed.', array('%host' => $form_state['values']['test'])));
       }
       else {
-        drupal_set_message(t('The hostname %host is allowed.', array('%host' => $form_values['test'])));
+        drupal_set_message(t('The hostname %host is allowed.', array('%host' => $form_state['values']['test'])));
       }
       break;
     default:
@@ -1819,8 +1820,8 @@ function user_admin_access_delete_confirm($aid = 0) {
   return $output;
 }
 
-function user_admin_access_delete_confirm_submit($form, &$form_state, $form_values) {
-  db_query('DELETE FROM {access} WHERE aid = %d', $form_values['aid']);
+function user_admin_access_delete_confirm_submit($form, &$form_state) {
+  db_query('DELETE FROM {access} WHERE aid = %d', $form_state['values']['aid']);
   drupal_set_message(t('The access rule has been deleted.'));
   $form_state['redirect'] = 'admin/user/rules';
   return;
@@ -1846,7 +1847,7 @@ function user_admin_access_edit($aid = 0) {
   return drupal_get_form('user_admin_access_edit_form', $edit, t('Save rule'));
 }
 
-function user_admin_access_form($edit, $submit) {
+function user_admin_access_form(&$form_state, $edit, $submit) {
   $form['status'] = array(
     '#type' => 'radios',
     '#title' => t('Access type'),
@@ -2012,17 +2013,17 @@ function theme_user_admin_perm($form) {
   return $output;
 }
 
-function user_admin_perm_submit($form, &$form_state, $form_values) {
+function user_admin_perm_submit($form, &$form_state) {
   // Save permissions:
   $result = db_query('SELECT * FROM {role}');
   while ($role = db_fetch_object($result)) {
-    if (isset($form_values[$role->rid])) {
+    if (isset($form_state['values'][$role->rid])) {
       // Delete, so if we clear every checkbox we reset that role;
       // otherwise permissions are active and denied everywhere.
       db_query('DELETE FROM {permission} WHERE rid = %d', $role->rid);
-      $form_values[$role->rid] = array_filter($form_values[$role->rid]);
-      if (count($form_values[$role->rid])) {
-        db_query("INSERT INTO {permission} (rid, perm) VALUES (%d, '%s')", $role->rid, implode(', ', array_keys($form_values[$role->rid])));
+      $form_state['values'][$role->rid] = array_filter($form_state['values'][$role->rid]);
+      if (count($form_state['values'][$role->rid])) {
+        db_query("INSERT INTO {permission} (rid, perm) VALUES (%d, '%s')", $role->rid, implode(', ', array_keys($form_state['values'][$role->rid])));
       }
     }
   }
@@ -2083,16 +2084,16 @@ function user_admin_role() {
   return $form;
 }
 
-function user_admin_role_validate($form, &$form_state, $form_values) {
-  if ($form_values['name']) {
-    if ($form_values['op'] == t('Save role')) {
-      if (db_result(db_query("SELECT COUNT(*) FROM {role} WHERE name = '%s' AND rid != %d", $form_values['name'], $form_values['rid']))) {
-        form_set_error('name', t('The role name %name already exists. Please choose another role name.', array('%name' => $form_values['name'])));
+function user_admin_role_validate($form, &$form_state) {
+  if ($form_state['values']['name']) {
+    if ($form_state['values']['op'] == t('Save role')) {
+      if (db_result(db_query("SELECT COUNT(*) FROM {role} WHERE name = '%s' AND rid != %d", $form_state['values']['name'], $form_state['values']['rid']))) {
+        form_set_error('name', t('The role name %name already exists. Please choose another role name.', array('%name' => $form_state['values']['name'])));
       }
     }
-    else if ($form_values['op'] == t('Add role')) {
-      if (db_result(db_query("SELECT COUNT(*) FROM {role} WHERE name = '%s'", $form_values['name']))) {
-        form_set_error('name', t('The role name %name already exists. Please choose another role name.', array('%name' => $form_values['name'])));
+    else if ($form_state['values']['op'] == t('Add role')) {
+      if (db_result(db_query("SELECT COUNT(*) FROM {role} WHERE name = '%s'", $form_state['values']['name']))) {
+        form_set_error('name', t('The role name %name already exists. Please choose another role name.', array('%name' => $form_state['values']['name'])));
       }
     }
   }
@@ -2101,21 +2102,21 @@ function user_admin_role_validate($form, &$form_state, $form_values) {
   }
 }
 
-function user_admin_role_submit($form, &$form_state, $form_values) {
-  if ($form_values['op'] == t('Save role')) {
-    db_query("UPDATE {role} SET name = '%s' WHERE rid = %d", $form_values['name'], $form_values['rid']);
+function user_admin_role_submit($form, &$form_state) {
+  if ($form_state['values']['op'] == t('Save role')) {
+    db_query("UPDATE {role} SET name = '%s' WHERE rid = %d", $form_state['values']['name'], $form_state['values']['rid']);
     drupal_set_message(t('The role has been renamed.'));
   }
-  else if ($form_values['op'] == t('Delete role')) {
-    db_query('DELETE FROM {role} WHERE rid = %d', $form_values['rid']);
-    db_query('DELETE FROM {permission} WHERE rid = %d', $form_values['rid']);
+  else if ($form_state['values']['op'] == t('Delete role')) {
+    db_query('DELETE FROM {role} WHERE rid = %d', $form_state['values']['rid']);
+    db_query('DELETE FROM {permission} WHERE rid = %d', $form_state['values']['rid']);
     // Update the users who have this role set:
-    db_query('DELETE FROM {users_roles} WHERE rid = %d', $form_values['rid']);
+    db_query('DELETE FROM {users_roles} WHERE rid = %d', $form_state['values']['rid']);
 
     drupal_set_message(t('The role has been deleted.'));
   }
-  else if ($form_values['op'] == t('Add role')) {
-    db_query("INSERT INTO {role} (name) VALUES ('%s')", $form_values['name']);
+  else if ($form_state['values']['op'] == t('Add role')) {
+    db_query("INSERT INTO {role} (name) VALUES ('%s')", $form_state['values']['name']);
     drupal_set_message(t('The role has been added.'));
   }
   $form_state['redirect'] = 'admin/user/roles';
@@ -2253,11 +2254,11 @@ function theme_user_admin_account($form) {
 /**
  * Submit the user administration update form.
  */
-function user_admin_account_submit($form, &$form_state, $form_values) {
+function user_admin_account_submit($form, &$form_state) {
   $operations = module_invoke_all('user_operations');
-  $operation = $operations[$form_values['operation']];
+  $operation = $operations[$form_state['values']['operation']];
   // Filter out unchecked accounts.
-  $accounts = array_filter($form_values['accounts']);
+  $accounts = array_filter($form_state['values']['accounts']);
   if ($function = $operation['callback']) {
     // Add in callback arguments if present.
     if (isset($operation['callback arguments'])) {
@@ -2272,9 +2273,9 @@ function user_admin_account_submit($form, &$form_state, $form_values) {
   }
 }
 
-function user_admin_account_validate($form, &$form_state, $form_values) {
-  $form_values['accounts'] = array_filter($form_values['accounts']);
-  if (count($form_values['accounts']) == 0) {
+function user_admin_account_validate($form, &$form_state) {
+  $form_state['values']['accounts'] = array_filter($form_state['values']['accounts']);
+  if (count($form_state['values']['accounts']) == 0) {
     form_set_error('', t('No users selected.'));
   }
 }
@@ -2424,10 +2425,10 @@ function user_multiple_delete_confirm() {
                       t('Delete all'), t('Cancel'));
 }
 
-function user_multiple_delete_confirm_submit($form, &$form_state, $form_values) {
-  if ($form_values['confirm']) {
-    foreach ($form_values['accounts'] as $uid => $value) {
-      user_delete($form_values, $uid);
+function user_multiple_delete_confirm_submit($form, &$form_state) {
+  if ($form_state['values']['confirm']) {
+    foreach ($form_state['values']['accounts'] as $uid => $value) {
+      user_delete($form_state['values'], $uid);
     }
     drupal_set_message(t('The users have been deleted.'));
   }
@@ -3002,17 +3003,17 @@ function theme_user_filters($form) {
 /**
  * Process result from user administration filter form.
  */
-function user_filter_form_submit($form, &$form_state, $form_values) {
-  $op = $form_values['op'];
+function user_filter_form_submit($form, &$form_state) {
+  $op = $form_state['values']['op'];
   $filters = user_filters();
   switch ($op) {
     case t('Filter'): case t('Refine'):
-      if (isset($form_values['filter'])) {
-        $filter = $form_values['filter'];
+      if (isset($form_state['values']['filter'])) {
+        $filter = $form_state['values']['filter'];
         // Merge an array of arrays into one if necessary.
         $options = $filter == 'permission' ? call_user_func_array('array_merge', $filters[$filter]['options']) : $filters[$filter]['options'];
-        if (isset($options[$form_values[$filter]])) {
-          $_SESSION['user_overview_filter'][] = array($filter, $form_values[$filter]);
+        if (isset($options[$form_state['values'][$filter]])) {
+          $_SESSION['user_overview_filter'][] = array($filter, $form_state['values'][$filter]);
         }
       }
       break;