diff --git a/core/modules/image/image.admin.inc b/core/modules/image/image.admin.inc
index b8f9c96..b5d0295 100644
--- a/core/modules/image/image.admin.inc
+++ b/core/modules/image/image.admin.inc
@@ -16,50 +16,49 @@
  */
 function theme_image_style_effects($variables) {
   $form = $variables['form'];
-  $rows = array();
+
+  $table = array(
+    '#type' => 'table',
+    '#header' => array(
+      t('Effect'),
+      t('Weight'),
+      t('Operations'),
+    ),
+    '#tabledrag' => array(
+      array('image-style-effects', 'order', 'sibling', 'image-effect-order-weight'),
+    ),
+    '#empty' => t('There are currently no effects in this style. Add one by selecting an option below.'),
+  );
+
+  $row_defaults = array(
+    '#attributes' => array(
+      'class' => array('draggable'),
+    )
+  );
 
   foreach (element_children($form) as $key) {
-    $row = array();
-    $form[$key]['weight']['#attributes']['class'] = array('image-effect-order-weight');
     if ($key != 'new') {
       $summary = drupal_render($form[$key]['summary']);
-      $row[] = drupal_render($form[$key]['label']) . (empty($summary) ? '' : ' ' . $summary);
-      $row[] = drupal_render($form[$key]['weight']);
-      $row[] = array('data' => $form[$key]['operations']);
+
+      $table[$key] = $row_defaults + array(
+        'label_summary' => array(
+          '#markup' => drupal_render($form[$key]['label']) . (empty($summary) ? '' : ' ' . $summary),
+        ),
+        'weight' => $form[$key]['weight'],
+        'operations' => $form[$key]['operations'],
+      );
     }
     else {
       // Add the row for adding a new image effect.
-      $row[] = '<div class="image-style-new">' . drupal_render($form['new']['new']) . drupal_render($form['new']['add']) . '</div>';
-      $row[] = drupal_render($form['new']['weight']);
-      $row[] = '';
+      $table[$key] = $row_defaults + array(
+        'image_style_new' => array(
+          'image_style_new_add' => $form[$key]['new'],
+          'image_style_new_submit' => $form[$key]['add'],
+        ),
+      );
     }
-
-    $rows[] = array(
-      'data' => $row,
-      'class' => array('draggable'),
-    );
-  }
-
-  $header = array(
-    t('Effect'),
-    t('Weight'),
-    t('Operations'),
-  );
-
-  if (count($rows) == 1 && (!isset($form['new']['#access']) || $form['new']['#access'])) {
-    array_unshift($rows, array(array(
-      'data' => t('There are currently no effects in this style. Add one by selecting an option below.'),
-      'colspan' => 4,
-    )));
   }
 
-  $table = array(
-    '#theme' => 'table',
-    '#header' => $header,
-    '#rows' => $rows,
-    '#attributes' => array('id' => 'image-style-effects'),
-  );
-  drupal_add_tabledrag('image-style-effects', 'order', 'sibling', 'image-effect-order-weight');
   return drupal_render($table);
 }
 
