=== modified file 'includes/form.inc'
--- includes/form.inc	
+++ includes/form.inc	
@@ -20,19 +20,35 @@
  * will attempt to validate it, using drupal_validate_form(),
  * and then submit the form using drupal_submit_form().
  *
- * @param $form_id
- *   A unique string identifying the form. Allows each form to be
- *   themed. Pass NULL to suppress the form_id parameter (produces
- *   a shorter URL with method=get)
- * @param $form
- *   An associative array containing the structure of the form.
- * @param $callback
- *   An optional callback that will be used in addition to the form_id.
- *
+ * @param $form_handler
+ *   A unique string identifying the form in the array returned from
+ *   hook_forms.
+ * @param ...
+ *   Any number of arguments passed to the form handler.
  */
-function drupal_get_form($form_id, &$form, $callback = NULL) {
+function drupal_get_form($form_handler) {
   global $form_values, $form_submitted, $user, $form_button_counter;
-  static $saved_globals = array();
+  static $saved_globals = array(), $forms;
+
+  $args = func_get_args();
+  $form_handler = array_shift($args);
+  if (!function_exists($form_handler)) {
+    if (!isset($forms)) {
+      $forms = module_invoke_all('forms');
+    }
+    $form_definition = $forms[$form_handler];
+    if (isset($form_definition['callback arguments'])) {
+      $args = array_merge($form_definition['callback arguments'], $args);
+    }
+    if (isset($form_definition['callback'])) {
+      $callback = $form_definition['callback'];
+    }
+  }
+  $form = call_user_func_array(isset($callback) ? $callback : $form_handler, $args);
+  $form_id = isset($form['#form_id']) ? $form['#form_id'] : $form_handler;
+  if (isset($form['#function_prefix'])) {
+    $function_prefix = $form['#function_prefix'];
+  }
 
   // Save globals in case of indirect recursive call
   array_push($saved_globals, array($form_values, $form_submitted, $form_button_counter));
@@ -41,20 +57,20 @@ function drupal_get_form($form_id, &$for
   $form_submitted = FALSE;
   $form_button_counter = array(0, 0);
 
-  $form = drupal_build_form($form_id, $form, $callback);
+  $form = drupal_build_form($form_id, $form, $function_prefix);
 
-  if (!empty($_POST['edit']) && (($_POST['edit']['form_id'] == $form_id) || ($_POST['edit']['form_id'] == $callback))) {
-    drupal_validate_form($form_id, $form, $callback);
+  if (!empty($_POST['edit']) && (($_POST['edit']['form_id'] == $form_id) || ($_POST['edit']['form_id'] == $function_prefix))) {
+    drupal_validate_form($form_id, $form);
     // IE does not send a button value when there is only one submit button (and no non-submit buttons)
     // and you submit by pressing enter.
     // In that case we accept a submission without button values.
     if (($form_submitted || (!$form_button_counter[0] && $form_button_counter[1])) && !form_get_errors()) {
-      $redirect = drupal_submit_form($form_id, $form, $callback);
+      $redirect = drupal_submit_form($form_id, $form);
       drupal_redirect_form($form, $redirect);
     }
   }
 
-  $output = drupal_render_form($form_id, $form, $callback);
+  $output = drupal_render_form($form_id, $form, $function_prefix);
   list($form_values, $form_submitted, $form_button_counter) = array_pop($saved_globals);
   return $output;
 }
@@ -69,11 +85,11 @@ function drupal_get_form($form_id, &$for
  *   theming, and hook_form_alter functions.
  * @param $form
  *   An associative array containing the structure of the form.
- * @param $callback
- *   An optional callback that will be used in addition to the form_id.
+ * @param $function_prefix
+ *   An optional function prefix that will be used in place of $form_id.
  *
  */
-function drupal_build_form($form_id, &$form, $callback = NULL) {
+function drupal_build_form($form_id, &$form, $function_prefix = NULL) {
   $form['#type'] = 'form';
   if (isset($form['#token'])) {
     // If the page cache is on and an anonymous user issues a GET request,
@@ -105,8 +121,8 @@ function drupal_build_form($form_id, &$f
     if (function_exists($form_id .'_validate')) {
       $form['#validate'] = array($form_id .'_validate' => array());
     }
-    elseif (function_exists($callback .'_validate')) {
-      $form['#validate'] = array($callback .'_validate' => array());
+    elseif (function_exists($function_prefix .'_validate')) {
+      $form['#validate'] = array($function_prefix .'_validate' => array());
     }
   }
 
@@ -116,8 +132,8 @@ function drupal_build_form($form_id, &$f
       // $form_values because it will change later
       $form['#submit'] = array($form_id .'_submit' => array());
     }
-    elseif (function_exists($callback .'_submit')) {
-      $form['#submit'] = array($callback .'_submit' => array());
+    elseif (function_exists($function_prefix .'_submit')) {
+      $form['#submit'] = array($function_prefix .'_submit' => array());
     }
   }
 
@@ -141,11 +157,9 @@ function drupal_build_form($form_id, &$f
  *   theming, and hook_form_alter functions.
  * @param $form
  *   An associative array containing the structure of the form.
- * @param $callback
- *   An optional callback that will be used in addition to the form_id.
  *
  */
-function drupal_validate_form($form_id, $form, $callback = NULL) {
+function drupal_validate_form($form_id, $form) {
   global $form_values;
   static $validated_forms = array();
 
@@ -175,14 +189,12 @@ function drupal_validate_form($form_id, 
  *   theming, and hook_form_alter functions.
  * @param $form
  *   An associative array containing the structure of the form.
- * @param $callback
- *   An optional callback that will be used in addition to the form_id.
  * @return
  *   A string containing the path of the page to display when processing
  *   is complete.
  *
  */
-function drupal_submit_form($form_id, $form, $callback = NULL) {
+function drupal_submit_form($form_id, $form) {
   global $form_values;
   $default_args = array($form_id, &$form_values);
 
@@ -209,21 +221,21 @@ function drupal_submit_form($form_id, $f
  *   theming, and hook_form_alter functions.
  * @param $form
  *   An associative array containing the structure of the form.
- * @param $callback
- *   An optional callback that will be used in addition to the form_id.
+ * @param $function_prefix
+ *   An optional function prefix that will be used in addition to the form_id.
  * @return
  *   A string containing the path of the page to display when processing
  *   is complete.
  *
  */
-function drupal_render_form($form_id, &$form, $callback = NULL) {
+function drupal_render_form($form_id, &$form, $function_prefix = NULL) {
   // Don't override #theme if someone already set it.
   if (!isset($form['#theme'])) {
     if (theme_get_function($form_id)) {
       $form['#theme'] = $form_id;
     }
-    elseif (theme_get_function($callback)) {
-      $form['#theme'] = $callback;
+    elseif (theme_get_function($function_prefix)) {
+      $form['#theme'] = $function_prefix;
     }
   }
 
=== modified file 'modules/system/system.module'
--- modules/system/system.module	
+++ modules/system/system.module	
@@ -133,7 +133,8 @@ function system_menu($may_cache) {
       'title' => t('administration theme'),
       'description' => t('Settings for how your administrative pages should look.'),
       'position' => 'left',
-      'callback' => 'system_admin_theme_settings',
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('system_admin_theme_settings'),
       'block callback' => 'system_admin_theme_settings',
       'access' => $access);
 
@@ -142,42 +143,56 @@ function system_menu($may_cache) {
       'path' => 'admin/build/themes',
       'title' => t('themes'),
       'description' => t('Change which theme your site uses or allows users to set.'),
-      'callback' => 'system_themes', 'access' => $access);
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('system_themes'),
+      'access' => $access);
 
     $items[] = array(
       'path' => 'admin/build/themes/select',
       'title' => t('list'),
       'description' => t('Select the default theme.'),
-      'callback' => 'system_themes',
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('system_themes'),
       'access' => $access,
       'type' => MENU_DEFAULT_LOCAL_TASK,
       'weight' => -1);
 
     $items[] = array('path' => 'admin/build/themes/settings',
       'title' => t('configure'),
-      'callback' => 'system_theme_settings',
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('system_theme_settings'),
       'access' => $access,
       'type' => MENU_LOCAL_TASK);
 
     // Theme configuration subtabs
-    $items[] = array('path' => 'admin/build/themes/settings/global', 'title' => t('global settings'),
-      'callback' => 'system_theme_settings', 'access' => $access,
+    $items[] = array(
+      'path' => 'admin/build/themes/settings/global',
+      'title' => t('global settings'),
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('system_theme_settings'),
+      'access' => $access,
       'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -1);
 
     foreach (list_themes() as $theme) {
       if ($theme->status) {
-        $items[] = array('path' => 'admin/build/themes/settings/'. $theme->name, 'title' => $theme->name,
-        'callback' => 'system_theme_settings', 'callback arguments' => array($theme->name), 'access' => $access,
+        $items[] = array(
+         'path' => 'admin/build/themes/settings/'. $theme->name,
+         'title' => $theme->name,
+        'callback' => 'drupal_get_form',
+        'callback arguments' => array('system_theme_settings', $theme->name),
+        'access' => $access,
         'type' => MENU_LOCAL_TASK);
       }
     }
 
     // Modules:
-    $items[] = array('path' => 'admin/settings/modules',
+    $items[] = array(
+      'path' => 'admin/settings/modules',
       'title' => t('modules'),
       'description' => t('Enable or disable add-on modules for your site.'),
       'weight' => -10,
-      'callback' => 'system_modules',
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('system_modules'),
       'access' => $access);
 
     // Settings:
@@ -185,47 +200,65 @@ function system_menu($may_cache) {
       'path' => 'admin/settings/site-information',
       'title' => t('site information'),
       'description' => t('Change basic site information, such as the site name, slogan, e-mail address, mission, front page and more.'),
-      'callback' => 'system_site_information_settings');
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('system_site_information_settings')
+    );
     $items[] = array(
       'path' => 'admin/settings/error-reporting',
       'title' => t('error reporting'),
       'description' => t('Control how Drupal deals with errors including 403/404 erros as well as PHP error reporting.'),
-      'callback' => 'system_error_reporting_settings');
+      'callback' => 'drupal_get_form',
+      'callback arguments' => ('system_error_reporting_settings'),
+    );
     $items[] = array(
       'path' => 'admin/settings/page-caching',
       'title' => t('page caching'),
       'description' => t('Enable or disable page caching for anonymous users.'),
-      'callback' => 'system_page_caching_settings');
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('system_page_caching_settings'),
+    );
     $items[] = array(
       'path' => 'admin/settings/file-system',
       'title' => t('file system'),
       'description' => t('Tell Drupal where to store uploaded files and how they are accessed.'),
-      'callback' => 'system_file_system_settings');
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('system_file_system_settings'),
+    );
     $items[] = array(
       'path' => 'admin/settings/image-toolkit',
       'title' => t('image toolkit'),
       'description' => t('Choose which image toolkit to use if you have installed optional toolkits.'),
-      'callback' => 'system_image_toolkit_settings');
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('system_image_toolkit_settings'),
+    );
     $items[] = array(
       'path' => 'admin/content/rss-feed',
       'title' => t('RSS feeds'),
       'description' => t('Configure the number of items per feed and whether feeds should be titles/teasers/full-text.'),
-      'callback' => 'system_rss_feeds_settings');
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('system_rss_feeds_settings'),
+    );
     $items[] = array(
       'path' => 'admin/settings/date-time',
       'title' => t('date and time'),
       'description' => t('Settings for how Drupal displays date and time, as well as the system\'s default timezone.'),
-      'callback' => 'system_date_time_settings');
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('system_date_time_settings'),
+    );
     $items[] = array(
       'path' => 'admin/settings/site-status',
       'title' => t('site status'),
       'description' => t('Take the site off-line for maintenance or bring it back online.'),
-      'callback' => 'system_site_status_settings');
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('system_site_status_settings'),
+    );
     $items[] = array(
       'path' => 'admin/settings/unicode',
       'title' => t('unicode'),
       'description' => t('Unicode string handling settings.'),
-      'callback' => 'system_unicode_settings');
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('system_unicode_settings'),
+    );
     $items[] = array(
       'path' => 'admin/settings/cron-status',
       'title' => t('cron status'),
@@ -235,7 +268,9 @@ function system_menu($may_cache) {
       'path' => 'admin/settings/clean-urls',
       'title' => t('clean URLs'),
       'description' => t('Enable or disable clean URLs for your site.'),
-      'callback' => 'system_clean_url_settings');
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('system_clean_url_settings'),
+    );
   }
   else {
     /**
@@ -361,7 +396,7 @@ function system_admin_theme_settings() {
   $form['#submit']['system_admin_theme_submit'] = array();
   $form['#submit']['system_settings_form_submit'] = array();
 
-  return system_settings_form('system_admin_theme_form', $form);
+  return system_settings_form($form);
 }
 
 
@@ -498,7 +533,7 @@ function system_site_information_setting
     '#description' => t('The home page displays content from this relative URL. If you are not using clean URLs, specify the part after "?q=". If unsure, specify "node".')
   );
 
-  return system_settings_form('system_site_information_settings', $form);
+  return system_settings_form($form);
 }
 
 function system_clean_url_settings() {
@@ -522,7 +557,7 @@ function system_clean_url_settings() {
     }
   }
 
-  return system_settings_form('system_clean_url_settings', $form);
+  return system_settings_form($form);
 }
 
 function system_error_reporting_settings() {
@@ -557,7 +592,7 @@ function system_error_reporting_settings
     '#description' => t('The time log entries should be kept. Older entries will be automatically discarded. Requires crontab.')
   );
 
-  return system_settings_form('system_error_reporting_settings', $form);
+  return system_settings_form($form);
 }
 
 function system_page_caching_settings() {
@@ -580,7 +615,7 @@ function system_page_caching_settings() 
     '#description' => t('Enabling the cache will offer a sufficient performance boost for most low-traffic and medium-traffic sites. On high-traffic sites it can become necessary to enforce a minimum cache lifetime. The minimum cache lifetime is the minimum amount of time that will go by before the cache is emptied and recreated. A larger minimum cache lifetime offers better performance, but users will not see new content for a longer period of time.')
   );
 
-  return system_settings_form('system_page_caching_settings', $form);
+  return system_settings_form($form);
 }
 
 function system_file_system_settings() {
@@ -611,7 +646,7 @@ function system_file_system_settings() {
     '#description' => t('If you want any sort of access control on the downloading of files, this needs to be set to <em>private</em>. You can change this at any time, however all download URLs will change and there may be unexpected problems so it is not recommended.')
   );
 
-  return system_settings_form('system_file_system_settings', $form);
+  return system_settings_form($form);
 }
 
 function system_image_toolkit_settings() {
@@ -624,10 +659,11 @@ function system_image_toolkit_settings()
       '#options' => $toolkits_available
     );
 
-    return system_settings_form('system_image_toolkit_settings', $form);
+    return system_settings_form($form);
   }
   else {
-    return '<p>'. t("No image toolkits found.  Drupal will use PHP's built-in GD library for image handling.") .'</p>';
+    $form['error'] = array('#value' => '<p>'. t("No image toolkits found.  Drupal will use PHP's built-in GD library for image handling.") .'</p>');
+    return $form;
   }
 }
 
@@ -648,7 +684,7 @@ function system_rss_feeds_settings() {
     '#description' => t('Global setting for the length of XML feed items that are output by default.')
   );
 
-  return system_settings_form('system_rss_feeds_settings', $form);
+  return system_settings_form($form);
 }
 
 function system_date_time_settings() {
@@ -726,7 +762,7 @@ function system_date_time_settings() {
     '#description' => t('The first day of the week for calendar views.')
   );
 
-  return system_settings_form('system_date_time_settings', $form);
+  return system_settings_form($form);
 }
 
 function system_site_status_settings() {
@@ -746,11 +782,12 @@ function system_site_status_settings() {
     '#description' => t('Message to show visitors when the site is in off-line mode.')
   );
 
-  return system_settings_form('system_site_status_settings', $form);
+  return system_settings_form($form);
 }
 
 function system_unicode_settings() {
-  return system_settings_form('system_unicode_settings', unicode_settings());
+  $form = unicode_settings();
+  return system_settings_form($form);
 }
 
 function system_cron_status($cron = '') {
@@ -1018,16 +1055,18 @@ function system_initialize_theme_blocks(
   }
 }
 
-// Add the submit / reset buttons and run drupal_get_form()
-function system_settings_form($form_id, $form) {
+/**
+ * Add default buttons to a form and set its prefix
+ */
+function system_settings_form($form) {
   $form['buttons']['submit'] = array('#type' => 'submit', '#value' => t('Save configuration') );
   $form['buttons']['reset'] = array('#type' => 'submit', '#value' => t('Reset to defaults') );
 
   if (!empty($_POST) && form_get_errors()) {
     drupal_set_message(t('The settings have not been saved because of the errors.'), 'error');
   }
-
-  return drupal_get_form($form_id, $form, 'system_settings_form');
+  $form['#function_prefix'] = 'system_settings_form';
+  return $form;
 }
 
 function system_theme_settings_submit($form_id, $values) {
@@ -1111,7 +1150,7 @@ function system_themes() {
   $form['buttons']['submit'] = array('#type' => 'submit', '#value' => t('Save configuration') );
   $form['buttons']['reset'] = array('#type' => 'submit', '#value' => t('Reset to defaults') );
 
-  return drupal_get_form('system_themes', $form);
+  return $form;
 }
 
 function theme_system_themes($form) {
@@ -1210,7 +1249,7 @@ function system_modules() {
 
   $form['buttons']['submit'] = array('#type' => 'submit', '#value' => t('Save configuration'));
 
-  return drupal_get_form('system_modules', $form);
+  return $form;
 }
 
 function theme_system_modules($form) {
@@ -1479,9 +1518,9 @@ function system_theme_settings($key = ''
     }
   }
   $form['#attributes'] = array('enctype' => 'multipart/form-data');
+//  $form['#render_prefix'] = 'confirm_form';
 
-  return system_settings_form('system_theme_settings', $form);
-
+  return system_settings_form($form);
 }
 
 /**
@@ -1527,7 +1566,7 @@ function confirm_form($form_id, $form, $
   $form['actions'] = array('#prefix' => '<div class="container-inline">', '#suffix' => '</div>');
   $form['actions']['submit'] = array('#type' => 'submit', '#value' => $yes ? $yes : t('Confirm'));
   $form['actions']['cancel'] = array('#value' => l($no ? $no : t('Cancel'), $path));
-  return drupal_get_form($form_id, $form, 'confirm_form');
+  return $form;
 }
 
 /**
=== modified file 'modules/user/user.module'
--- modules/user/user.module	
+++ modules/user/user.module	
@@ -469,6 +469,35 @@ function user_user($type, &$edit, &$user
   }
 }
 
+function user_login_block() {
+  $form = array(
+    '#action' => url($_GET['q'], drupal_get_destination()),
+    '#id' => 'user-login-form',
+    '#function_prefix' => 'user_login',
+  );
+  $form['name'] = array('#type' => 'textfield',
+    '#title' => t('Username'),
+    '#maxlength' => 60,
+    '#size' => 15,
+    '#required' => TRUE,
+  );
+  $form['pass'] = array('#type' => 'password',
+    '#title' => t('Password'),
+    '#size' => 15,
+    '#required' => TRUE,
+  );
+  $form['submit'] = array('#type' => 'submit',
+    '#value' => t('Log in'),
+  );
+
+  if (variable_get('user_register', 1)) {
+    $items[] = l(t('Create new account'), 'user/register', array('title' => t('Create a new user account.')));
+  }
+  $items[] = l(t('Request new password'), 'user/password', array('title' => t('Request new password via e-mail.')));
+  $form['links'] = array('#value' => theme('item_list', $items));
+  return $form;
+}
+
 /**
  * Implementation of hook_block().
  */
@@ -501,31 +530,9 @@ function user_block($op = 'list', $delta
       case 0:
         // For usability's sake, avoid showing two login forms on one page.
         if (!$user->uid && !(arg(0) == 'user' && !is_numeric(arg(1)))) {
-          $form['#action'] = url($_GET['q'], drupal_get_destination());
-          $form['#id'] = 'user-login-form';
-          $form['name'] = array('#type' => 'textfield',
-            '#title' => t('Username'),
-            '#maxlength' => 60,
-            '#size' => 15,
-            '#required' => TRUE,
-          );
-          $form['pass'] = array('#type' => 'password',
-            '#title' => t('Password'),
-            '#size' => 15,
-            '#required' => TRUE,
-          );
-          $form['submit'] = array('#type' => 'submit',
-            '#value' => t('Log in'),
-          );
-
-          if (variable_get('user_register', 1)) {
-            $items[] = l(t('Create new account'), 'user/register', array('title' => t('Create a new user account.')));
-          }
-          $items[] = l(t('Request new password'), 'user/password', array('title' => t('Request new password via e-mail.')));
-          $form['links'] = array('#value' => theme('item_list', $items));
 
           $block['subject'] = t('User login');
-          $block['content'] = drupal_get_form('user_login_block', $form, 'user_login');
+          $block['content'] = drupal_get_form('user_login_block');
         }
         return $block;
 
@@ -669,8 +676,14 @@ function user_menu($may_cache) {
   $view_access = user_access('access user profiles');
 
   if ($may_cache) {
-    $items[] = array('path' => 'user', 'title' => t('user account'),
-      'callback' => 'user_login', 'access' => TRUE, 'type' => MENU_CALLBACK);
+    $items[] = array(
+      'path' => 'user',
+      'title' => t('user account'),
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('user_login'),
+      'access' => TRUE,
+      'type' => MENU_CALLBACK
+    );
 
     $items[] = array('path' => 'user/autocomplete', 'title' => t('user autocomplete'),
       'callback' => 'user_autocomplete', 'access' => $view_access, 'type' => MENU_CALLBACK);
@@ -678,12 +691,29 @@ function user_menu($may_cache) {
     // Registration and login pages.
     $items[] = array('path' => 'user/login', 'title' => t('log in'),
       'callback' => 'user_login', 'type' => MENU_DEFAULT_LOCAL_TASK);
-    $items[] = array('path' => 'user/register', 'title' => t('create new account'),
-      'callback' => 'user_register', 'access' => $user->uid == 0 && variable_get('user_register', 1), 'type' => MENU_LOCAL_TASK);
-    $items[] = array('path' => 'user/password', 'title' => t('request new password'),
-      'callback' => 'user_pass', 'access' => $user->uid == 0, 'type' => MENU_LOCAL_TASK);
-    $items[] = array('path' => 'user/reset', 'title' => t('reset password'),
-      'callback' => 'user_pass_reset', 'access' => TRUE, 'type' => MENU_CALLBACK);
+    $items[] = array(
+      'path' => 'user/register',
+      'title' => t('create new account'),
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('user_register'),
+      'access' => $user->uid == 0 && variable_get('user_register', 1),
+      'type' => MENU_LOCAL_TASK);
+    $items[] = array(
+      'path' => 'user/password',
+      'title' => t('request new password'),
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('user_pass'),
+      'access' => !$user->uid,
+      'type' => MENU_LOCAL_TASK
+    );
+    $items[] = array(
+      'path' => 'user/reset',
+      'title' => t('reset password'),
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('user_pass_reset'),
+      'access' => TRUE,
+      'type' => MENU_CALLBACK
+    );
     $items[] = array('path' => 'user/help', 'title' => t('help'),
       'callback' => 'user_help_page', 'type' => MENU_CALLBACK);
 
@@ -708,24 +738,38 @@ function user_menu($may_cache) {
       'callback' => 'user_admin_settings');
 
     // Admin access pages
-    $items[] = array('path' => 'admin/user/access', 'title' => t('access control'),
+    $items[] = array(
+      'path' => 'admin/user/access',
+      'title' => t('access control'),
       'description' => t('Determine access to features by selecting permissions for roles.'),
-      'callback' => 'user_admin_perm', 'access' => $access_access);
-    $items[] = array('path' => 'admin/user/roles', 'title' => t('roles'),
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('user_admin_perm'),
+      'access' => $access_access
+    );
+    $items[] = array(
+      'path' => 'admin/user/roles',
+      'title' => t('roles'),
       'description' => t('List, edit, or add user roles.'),
-      'callback' => 'user_admin_role', 'access' => $access_access,
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('user_admin_role'),
+      'access' => $access_access,
       'type' => MENU_NORMAL_ITEM);
-    $items[] = array('path' => 'admin/user/roles/edit', 'title' => t('edit role'),
-      'callback' => 'user_admin_role', 'access' => $access_access,
+    $items[] = array(
+      'path' => 'admin/user/roles/edit',
+      'title' => t('edit role'),
       'type' => MENU_CALLBACK);
     $items[] = array('path' => 'admin/user/rules', 'title' => t('access rules'),
       'description' => t('List and create rules to disallow usernames, e-mail addresses, and IP addresses.'),
       'callback' => 'user_admin_access', 'access' => $access_access);
     $items[] = array('path' => 'admin/user/rules/list', 'title' => t('list'),
       'access' => $access_access, 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
-    $items[] = array('path' => 'admin/user/rules/add', 'title' => t('add rule'),
-      'callback' => 'user_admin_access_add', 'access' => $access_access,
-      'type' => MENU_LOCAL_TASK);
+    $items[] = array(
+      'path' => 'admin/user/rules/add',
+      'title' => t('add rule'),
+      'callback' => 'user_admin_access_add',
+      'access' => $access_access,
+      'type' => MENU_LOCAL_TASK,
+    );
     $items[] = array('path' => 'admin/user/rules/check', 'title' => t('check rules'),
       'callback' => 'user_admin_access_check', 'access' => $access_access,
       'type' => MENU_LOCAL_TASK);
@@ -772,9 +816,14 @@ function user_menu($may_cache) {
         $items[] = array('path' => 'user/'. arg(1) .'/view', 'title' => t('view'),
           'access' => $view_access, 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
 
-        $items[] = array('path' => 'user/'. arg(1) .'/edit', 'title' => t('edit'),
-          'callback' => 'user_edit', 'access' => $admin_access || $user->uid == arg(1),
-          'type' => MENU_LOCAL_TASK);
+        $items[] = array(
+          'path' => 'user/'. arg(1) .'/edit',
+          'title' => t('edit'),
+          'callback' => 'drupal_get_form',
+          'callback arguments' => array('user_edit'),
+          'access' => $admin_access || $user->uid == arg(1),
+          'type' => MENU_LOCAL_TASK
+        );
         $items[] = array('path' => 'user/'. arg(1) .'/delete', 'title' => t('delete'),
           'callback' => 'user_edit', 'access' => $admin_access,
           'type' => MENU_CALLBACK);
@@ -876,7 +925,7 @@ function user_login($msg = '') {
     '#attributes' => array('tabindex' => '2'),
   );
   $form['submit'] = array('#type' => 'submit', '#value' => t('Log in'), '#weight' => 2, '#attributes' => array('tabindex' => '3'));
-  return drupal_get_form('user_login', $form);
+  return $form;
 }
 
 function user_login_validate($form_id, $form_values) {
@@ -1008,7 +1057,7 @@ function user_pass() {
     '#value' => t('E-mail new password'),
     '#weight' => 2,
   );
-  return drupal_get_form('user_pass', $form);
+  return $form;
 }
 
 function user_pass_validate() {
@@ -1098,7 +1147,7 @@ function user_pass_reset($uid, $timestam
           $form['help'] = array('#value' => t('<p>This login can be used only once.</p>'));
           $form['submit'] = array('#type' => 'submit', '#value' => t('Log in'));
           $form['#action'] = url("user/reset/$uid/$timestamp/$hashed_pass/login");
-          return drupal_get_form('user_pass_reset', $form);
+          return $form;
         }
       }
       else {
@@ -1110,6 +1159,7 @@ function user_pass_reset($uid, $timestam
       // Deny access, no more clues.
       // Everything will be in the watchdog's URL for the administrator to check.
       drupal_access_denied();
+      exit;
     }
   }
 }
@@ -1174,7 +1224,7 @@ function user_register() {
   }
   $form['submit'] = array('#type' => 'submit', '#value' => t('Create new account'), '#weight' => 30);
 
-  return drupal_get_form('user_register', $form);
+  return $form;
 }
 
 function user_register_validate($form_id, $form_values) {
@@ -1404,7 +1454,7 @@ function user_edit($category = 'account'
   $form['#attributes']['enctype'] = 'multipart/form-data';
 
   drupal_set_title($account->name);
-  return drupal_get_form('user_edit', $form);
+  return $form;
 }
 
 /**
@@ -1511,31 +1561,43 @@ function _user_mail_text($messageid, $va
   }
 }
 
-/**
- * Menu callback: check an access rule
- */
-function user_admin_access_check() {
+function user_admin_check_user() {
   $form['user'] = array('#type' => 'fieldset', '#title' => t('Username'));
   $form['user']['test'] = array('#type' => 'textfield', '#title' => '', '#description' => t('Enter a username to check if it will be denied or allowed.'), '#size' => 30, '#maxlength' => 64);
   $form['user']['type'] = array('#type' => 'hidden', '#value' => 'user');
   $form['user']['submit'] = array('#type' => 'submit', '#value' => t('Check username'));
-  $output .= drupal_get_form('check_user', $form, 'user_admin_access_check');
-  unset($form); // prevent endless loop?
+  $form['#function_prefix'] = 'user_admin_access_check';
+  $form['#form_id'] = 'check_user';
+  return $form;
+}
 
+function user_admin_check_mail() {
   $form['mail'] = array('#type' => 'fieldset', '#title' => t('E-mail'));
   $form['mail']['test'] = array('#type' => 'textfield', '#title' => '', '#description' => t('Enter an e-mail address to check if it will be denied or allowed.'), '#size' => 30, '#maxlength' => 64);
   $form['mail']['type'] = array('#type' => 'hidden', '#value' => 'mail');
   $form['mail']['submit'] = array('#type' => 'submit', '#value' => t('Check e-mail'));
-  $output .= drupal_get_form('check_mail', $form, 'user_admin_access_check');
-  unset($form); // prevent endless loop?
+  $form['#function_prefix'] = 'user_admin_access_check';
+  $form['#form_id'] = 'check_mail';
+  return $form;
+}
 
+function user_admin_check_host() {
   $form['host'] = array('#type' => 'fieldset', '#title' => t('Hostname'));
   $form['host']['test'] = array('#type' => 'textfield', '#title' => '', '#description' => t('Enter a hostname or IP address to check if it will be denied or allowed.'), '#size' => 30, '#maxlength' => 64);
   $form['host']['type'] = array('#type' => 'hidden', '#value' => 'host');
   $form['host']['submit'] = array('#type' => 'submit', '#value' => t('Check hostname'));
-  $output .= drupal_get_form('check_host', $form, 'user_admin_access_check');
-  unset($form); // prevent endless loop?
+  $form['#function_prefix'] = 'user_admin_access_check';
+  $form['#form_id'] = 'check_host';
+  return $form;
+}
 
+/**
+ * Menu callback: check an access rule
+ */
+function user_admin_access_check() {
+  $output = drupal_get_form('user_admin_check_user');
+  $output .= drupal_get_form('user_admin_check_mail');
+  $output .= drupal_get_form('user_admin_check_host');
   return $output;
 }
 
@@ -1596,10 +1658,7 @@ function user_admin_access_add($mask = N
     $edit['type'] = $type;
   }
 
-  $form = _user_admin_access_form($edit);
-  $form['submit'] = array('#type' => 'submit', '#value' => t('Add rule'));
-
-  return drupal_get_form('access_rule', $form);
+  return drupal_get_form('user_admin_access_form', $edit, 'access_rule', t('Add rule'));
 }
 
 /**
@@ -1643,13 +1702,11 @@ function user_admin_access_edit($aid = 0
   else {
     $edit = db_fetch_array(db_query('SELECT aid, type, status, mask FROM {access} WHERE aid = %d', $aid));
   }
-  $form = _user_admin_access_form($edit);
-  $form['submit'] = array('#type' => 'submit', '#value' => t('Save rule'));
-
-  return drupal_get_form('access_rule', $form);
+  return drupal_get_form('user_admin_access_form', $edit, 'access_edit', t('Save rule'));
 }
 
-function _user_admin_access_form($edit) {
+function user_admin_access_form($edit, $form_id, $submit) {
+  $form['#form_id'] = $form_id;
   $form['status'] = array(
     '#type' => 'radios',
     '#title' => t('Access type'),
@@ -1672,6 +1729,8 @@ function _user_admin_access_form($edit) 
     '#description' => '%: '. t('Matches any number of characters, even zero characters') .'.<br />_: '. t('Matches exactly one character.'),
     '#required' => TRUE,
   );
+  $form['submit'] = array('#type' => 'submit', '#value' => $submit);
+
   return $form;
 }
 
@@ -1783,7 +1842,7 @@ function user_admin_perm($str_rids = NUL
   }
   $form['submit'] = array('#type' => 'submit', '#value' => t('Save permissions'));
 
-  return drupal_get_form('user_admin_perm', $form);
+  return $form;
 }
 
 function theme_user_admin_perm($form) {
@@ -1887,11 +1946,13 @@ function user_admin_role() {
     $form['name'] = array('#type' => 'textfield', '#title' => t('Role name'), '#default_value' => $role->name, '#size' => 30, '#maxlength' => 64, '#description' => t('The name for this role. Example: "moderator", "editorial board", "site architect".'));
     $form['submit'] = array('#type' => 'submit', '#value' => t('Save role'));
     $form['delete'] = array('#type' => 'submit', '#value' => t('Delete role'));
-    return drupal_get_form('user_admin_role', $form);
+    
+    return $form;
   }
   $form['name'] = array('#type' => 'textfield', '#size' => 32, '#maxlength' => 64);
   $form['submit'] = array('#type' => 'submit', '#value' => t('Add role'));
-  return drupal_get_form('user_admin_new_role', $form);
+  $form['#form_id'] = 'user_admin_new_role';
+  return $form;
 }
 
 function theme_user_admin_new_role($form) {
@@ -1911,7 +1972,7 @@ function theme_user_admin_new_role($form
 
 function user_admin_account() {
   if ($_POST['edit']['accounts'] && $_POST['edit']['operation'] == 'delete') {
-    return user_multiple_delete_confirm();
+    return user_multiple_delete_confirm(); // TODO
   }
 
   $header = array(
@@ -1974,10 +2035,7 @@ function user_admin_account() {
   );
   $form['pager'] = array('#value' => theme('pager', NULL, 50, 0));
 
-  // Call the form first, to allow for the form_values array to be populated.
-  $output .= drupal_get_form('user_admin_account', $form);
-
-  return $output;
+  return $form;
 }
 
 /**
@@ -2201,7 +2259,7 @@ function user_admin($callback_arg = '') 
       $output = user_register();
       break;
     default:
-      $output = user_admin_account();
+      $output = drupal_get_form('user_admin_account');
   }
   return $output;
 }
