diff --git a/core/includes/common.inc b/core/includes/common.inc
index c117d43..fd85dd3 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -6188,45 +6188,6 @@ function drupal_render_cid_create($elements) {
 }
 
 /**
- * Sorts a structured array by '#weight' property.
- *
- * Callback for uasort() within element_children().
- *
- * @param $a
- *   First item for comparison. The compared items should be associative arrays
- *   that optionally include a '#weight' key.
- * @param $b
- *   Second item for comparison.
- */
-function element_sort($a, $b) {
-  $a_weight = (is_array($a) && isset($a['#weight'])) ? $a['#weight'] : 0;
-  $b_weight = (is_array($b) && isset($b['#weight'])) ? $b['#weight'] : 0;
-  if ($a_weight == $b_weight) {
-    return 0;
-  }
-  return ($a_weight < $b_weight) ? -1 : 1;
-}
-
-/**
- * Sorts a structured array by '#title' property.
- *
- * Callback for uasort() within:
- * - system_modules()
- * - theme_simpletest_test_table()
- *
- * @param $a
- *   First item for comparison. The compared items should be associative arrays
- *   that optionally include a '#title' key.
- * @param $b
- *   Second item for comparison.
- */
-function element_sort_by_title($a, $b) {
-  $a_title = (is_array($a) && isset($a['#title'])) ? $a['#title'] : '';
-  $b_title = (is_array($b) && isset($b['#title'])) ? $b['#title'] : '';
-  return strnatcasecmp($a_title, $b_title);
-}
-
-/**
  * Retrieves the default properties for the defined element type.
  *
  * @param $type
@@ -6284,12 +6245,9 @@ function element_info_property($type, $property_name, $default = NULL) {
  *   Second item for comparison.
  */
 function drupal_sort_weight($a, $b) {
-  $a_weight = (is_array($a) && isset($a['weight'])) ? $a['weight'] : 0;
-  $b_weight = (is_array($b) && isset($b['weight'])) ? $b['weight'] : 0;
-  if ($a_weight == $b_weight) {
-    return 0;
-  }
-  return ($a_weight < $b_weight) ? -1 : 1;
+  $a_weight = (is_array($a) && isset($a['#weight'])) ? (int) $a['#weight'] : 0;
+  $b_weight = (is_array($b) && isset($b['#weight'])) ? (int) $b['#weight'] : 0;
+  return $a_weight - $b_weight;
 }
 
 /**
@@ -6372,7 +6330,7 @@ function element_children(&$elements, $sort = FALSE) {
   }
   // Sort the children if necessary.
   if ($sort && $sortable) {
-    uasort($children, 'element_sort');
+    uasort($children, 'drupal_sort_weight');
     // Put the sorted children back into $elements in the correct order, to
     // preserve sorting if the same element is passed through
     // element_children() twice.
diff --git a/core/modules/field/field.module b/core/modules/field/field.module
index 2d31efa..2aed40b 100644
--- a/core/modules/field/field.module
+++ b/core/modules/field/field.module
@@ -532,7 +532,7 @@ function _field_sort_items($field, $items) {
 
 /**
  * Sort function for items order.
- * (copied form element_sort(), which acts on #weight keys)
+ * (copied form drupal_sort_weight(), which acts on #weight keys)
  */
 function _field_sort_items_helper($a, $b) {
   $a_weight = (is_array($a) ? $a['_weight'] : 0);
diff --git a/core/modules/simpletest/simpletest.pages.inc b/core/modules/simpletest/simpletest.pages.inc
index d189159..bf2ebcb 100644
--- a/core/modules/simpletest/simpletest.pages.inc
+++ b/core/modules/simpletest/simpletest.pages.inc
@@ -128,7 +128,7 @@ function theme_simpletest_test_table($variables) {
     );
 
     // Sorting $element by children's #title attribute instead of by class name.
-    uasort($element, 'element_sort_by_title');
+    uasort($element, 'drupal_sort_title');
 
     // Cycle through each test within the current group.
     foreach (element_children($element) as $test_name) {
diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc
index 6dca80b..bd1db7f 100644
--- a/core/modules/system/system.admin.inc
+++ b/core/modules/system/system.admin.inc
@@ -906,7 +906,7 @@ function system_modules($form, $form_state = array()) {
   }
 
   // Lastly, sort all fieldsets by title.
-  uasort($form['modules'], 'element_sort_by_title');
+  uasort($form['modules'], 'drupal_sort_title');
 
   $form['actions'] = array('#type' => 'actions');
   $form['actions']['submit'] = array(
