diff --git a/core/modules/user/user.admin.inc b/core/modules/user/user.admin.inc
index c3931d8..a493b15 100644
--- a/core/modules/user/user.admin.inc
+++ b/core/modules/user/user.admin.inc
@@ -858,10 +858,16 @@ function user_admin_roles($form, $form_state) {
   $roles = user_roles();
 
   $form['roles'] = array(
+    '#type' => 'table',
     '#tree' => TRUE,
+    '#header' => array(t('Name'), t('Weight'), t('Operations')),
+    '#tabledrag' => array(
+      array('order', 'sibling', 'role-weight'),
+    ),
   );
 
   foreach ($roles as $rid => $role) {
+    $form['roles'][$rid]['#attributes']['class'][] = 'draggable';
     $form['roles'][$rid]['#role'] = $role;
     $form['roles'][$rid]['#weight'] = $role->weight;
     $form['roles'][$rid]['name'] = array(
@@ -896,11 +902,23 @@ function user_admin_roles($form, $form_state) {
     'id' => NULL,
     'label' => NULL,
   ));
+
   $add_form = user_admin_role(array(), $form_state, $add_role);
   $add_form['actions']['submit']['#submit'] = array('user_admin_role_submit');
-  $add_form['role']['actions'] = $add_form['actions'];
-  unset($add_form['actions']);
-  $form += $add_form;
+  $actions = $add_form['actions'];
+  unset($form['role']['weight']);
+
+  // Distribute the role add form into table columns.
+  $add_form['role']['label']['#title_display'] = 'invisible';
+  unset($add_form['role']['label']['#description']);
+  unset($add_form['role']['rid']['#description']);
+
+  // Ensure the machine name is connected to the role label field.
+  $add_form['role']['id']['#machine_name']['source'] = array('roles', 'add', 'name', 'label');
+
+  $form['roles']['add']['name'] = $add_form['role'];
+  $form['roles']['add']['weight'] = array();
+  $form['roles']['add']['operations'] = $actions;
 
   $form['actions']['#type'] = 'actions';
   $form['actions']['submit'] = array(
@@ -919,55 +937,13 @@ function user_admin_roles($form, $form_state) {
  */
 function user_admin_roles_order_submit($form, &$form_state) {
   foreach ($form_state['values']['roles'] as $rid => $role_values) {
-    $role = $form['roles'][$rid]['#role'];
-    $role->weight = $role_values['weight'];
-    $role->save();
-  }
-  drupal_set_message(t('The role settings have been updated.'));
-}
-
-/**
- * Returns HTML for the role order and new role form.
- *
- * @param $variables
- *   An associative array containing:
- *   - form: A render element representing the form.
- *
- * @ingroup themeable
- */
-function theme_user_admin_roles($variables) {
-  $form = $variables['form'];
-
-  $header = array(t('Name'), t('Weight'), t('Operations'));
-  foreach (element_children($form['roles']) as $rid) {
-    $row = array();
-    foreach (element_children($form['roles'][$rid]) as $column) {
-      $row[] = drupal_render($form['roles'][$rid][$column]);
+    if (isset($form['roles'][$rid]['#role'])) {
+      $role = $form['roles'][$rid]['#role'];
+      $role->weight = $role_values['weight'];
+      $role->save();
     }
-    $rows[] = array('data' => $row, 'class' => array('draggable'));
   }
-
-  // Distribute the role add form into table columns.
-  $form['role']['name']['#title_display'] = 'invisible';
-  unset($form['role']['name']['#description']);
-  unset($form['role']['rid']['#description']);
-
-  $actions = $form['role']['actions'];
-  unset($form['role']['actions']);
-  unset($form['role']['weight']);
-  $row = array();
-  $row[] = drupal_render($form['role']);
-  // Empty placeholder for the weight column.
-  $row[] = '';
-  $row[] = array('data' => drupal_render($actions), 'colspan' => 2);
-  $rows[] = array('data' => $row);
-
-  drupal_add_tabledrag('user-roles', 'order', 'sibling', 'role-weight');
-
-  $output = theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'user-roles')));
-  $output .= drupal_render_children($form);
-
-  return $output;
+  drupal_set_message(t('The role settings have been updated.'));
 }
 
 /**
diff --git a/core/modules/user/user.module b/core/modules/user/user.module
index bdf5862..e5f3389 100644
--- a/core/modules/user/user.module
+++ b/core/modules/user/user.module
@@ -99,10 +99,6 @@ function user_theme() {
       'render element' => 'form',
       'file' => 'user.admin.inc',
     ),
-    'user_admin_roles' => array(
-      'render element' => 'form',
-      'file' => 'user.admin.inc',
-    ),
     'user_permission_description' => array(
       'variables' => array('permission_item' => NULL, 'hide' => NULL),
       'file' => 'user.admin.inc',
