diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index b20de08..60462a3 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -2080,174 +2080,60 @@ function theme_breadcrumb($variables) {
 function theme_table($variables) {
   $header = $variables['header'];
   $rows = $variables['rows'];
-  $attributes = $variables['attributes'];
+  $table_attributes = $variables['attributes'];
   $caption = $variables['caption'];
   $colgroups = $variables['colgroups'];
-  $sticky = $variables['sticky'];
-  $responsive = $variables['responsive'];
-  $empty = $variables['empty'];
 
-  // Add sticky headers, if applicable.
-  if (count($header) && $sticky) {
-    drupal_add_library('system', 'drupal.tableheader');
-    // Add 'sticky-enabled' class to the table to identify it for JS.
-    // This is needed to target tables constructed by this function.
-    $attributes['class'][] = 'sticky-enabled';
-  }
-  // If the table has headers and it should react responsively to columns hidden
-  // with the classes represented by the constants RESPONSIVE_PRIORITY_MEDIUM
-  // and RESPONSIVE_PRIORITY_LOW, add the tableresponsive behaviors.
-  if (count($header) && $responsive) {
-    drupal_add_library('system', 'drupal.tableresponsive');
-    // Add 'responsive-enabled' class to the table to identify it for JS.
-    // This is needed to target tables constructed by this function.
-    $attributes['class'][] = 'responsive-enabled';
-  }
-
-  $output = '<table' . new Attribute($attributes) . ">\n";
+  $output = '<table' . $table_attributes . ">\n";
 
   if (isset($caption)) {
     $output .= '<caption>' . $caption . "</caption>\n";
   }
 
   // Format the table columns:
-  if (count($colgroups)) {
+  if (!empty($colgroups)) {
     foreach ($colgroups as $number => $colgroup) {
-      $attributes = array();
-
-      // Check if we're dealing with a simple or complex column
-      if (isset($colgroup['data'])) {
-        foreach ($colgroup as $key => $value) {
-          if ($key == 'data') {
-            $cols = $value;
-          }
-          else {
-            $attributes[$key] = $value;
-          }
-        }
-      }
-      else {
-        $cols = $colgroup;
-      }
 
       // Build colgroup
-      if (is_array($cols) && count($cols)) {
-        $output .= ' <colgroup' . new Attribute($attributes) . '>';
-        $i = 0;
-        foreach ($cols as $col) {
-          $output .= ' <col' . new Attribute($col) . ' />';
+      if (is_array($colgroup['cols']) && !empty($colgroup['cols'])) {
+        $output .= ' <colgroup' . $colgroup['attributes'] . '>';
+        foreach ($colgroup['cols'] as $col) {
+          $output .= ' <col' . $col['attributes'] . ' />';
         }
         $output .= " </colgroup>\n";
       }
       else {
-        $output .= ' <colgroup' . new Attribute($attributes) . " />\n";
+        $output .= ' <colgroup' . $colgroup['attributes'] . " />\n";
       }
     }
   }
 
-  // Add the 'empty' row message if available.
-  if (!count($rows) && $empty) {
-    $header_count = 0;
-    foreach ($header as $header_cell) {
-      if (is_array($header_cell)) {
-        $header_count += isset($header_cell['colspan']) ? $header_cell['colspan'] : 1;
-      }
-      else {
-        $header_count++;
-      }
-    }
-    $rows[] = array(array(
-        'data' => $empty,
-        'colspan' => $header_count,
-        'class' => array('empty', 'message'),
-      ));
-  }
-
-  $responsive = array();
   // Format the table header:
-  if (count($header)) {
-    $ts = tablesort_init($header);
+  if (!empty($header)) {
     // HTML requires that the thead tag has tr tags in it followed by tbody
     // tags. Using ternary operator to check and see if we have any rows.
-    $output .= (count($rows) ? ' <thead><tr>' : ' <tr>');
-    $i = 0;
+    $output .= (!empty($rows) ? ' <thead><tr>' : ' <tr>');
     foreach ($header as $cell) {
-      $i++;
-      // Track responsive classes for each column as needed. Only the header
-      // cells for a column are marked up with the responsive classes by a
-      // module developer or themer. The responsive classes on the header cells
-      // must be transferred to the content cells.
-      if (!empty($cell['class']) && is_array($cell['class'])) {
-        if (in_array(RESPONSIVE_PRIORITY_MEDIUM, $cell['class'])) {
-          $responsive[$i] =  RESPONSIVE_PRIORITY_MEDIUM;
-        }
-        elseif (in_array(RESPONSIVE_PRIORITY_LOW, $cell['class'])) {
-          $responsive[$i] =  RESPONSIVE_PRIORITY_LOW;
-        }
-      }
-      $cell = tablesort_header($cell, $header, $ts);
-      $output .= _theme_table_cell($cell, TRUE);
+      $output .= theme('table_cell', $cell);
     }
     // Using ternary operator to close the tags based on whether or not there are rows
-    $output .= (count($rows) ? " </tr></thead>\n" : "</tr>\n");
+    $output .= (!empty($rows) ? " </tr></thead>\n" : "</tr>\n");
   }
   else {
     $ts = array();
   }
 
   // Format the table rows:
-  if (count($rows)) {
+  if (!empty($rows)) {
     $output .= "<tbody>\n";
-    $flip = array(
-      'even' => 'odd',
-      'odd' => 'even',
-    );
-    $class = 'even';
     foreach ($rows as $number => $row) {
-      $attributes = array();
-
-      // Check if we're dealing with a simple or complex row
-      if (isset($row['data'])) {
-        foreach ($row as $key => $value) {
-          if ($key == 'data') {
-            $cells = $value;
-          }
-          else {
-            $attributes[$key] = $value;
-          }
-        }
-      }
-      else {
-        $cells = $row;
-      }
-      if (count($cells)) {
-        // Add odd/even class
-        if (empty($row['no_striping'])) {
-          $class = $flip[$class];
-          $attributes['class'][] = $class;
-        }
-
+      $cells = $row['cells'];
+      if (!empty($cells)) {
+     
         // Build row
-        $output .= ' <tr' . new Attribute($attributes) . '>';
-        $i = 0;
+        $output .= ' <tr' . $row['attributes'] . '>';
         foreach ($cells as $cell) {
-          $i++;
-          // Add active class if needed for sortable tables.
-          $cell = tablesort_cell($cell, $header, $ts, $i);
-          // Copy RESPONSIVE_PRIORITY_LOW/RESPONSIVE_PRIORITY_MEDIUM
-          // class from header to cell as needed.
-          if (isset($responsive[$i])) {
-            if (is_array($cell)) {
-              $cell['class'][] = $responsive[$i];
-            }
-            else {
-              $cell = array(
-                'data' => $cell,
-                'class' => $responsive[$i],
-              );
-            }
-          }
-          $output .= _theme_table_cell($cell);
+          $output .= theme('table_cell', $cell);
         }
         $output .= " </tr>\n";
       }
@@ -2261,49 +2147,59 @@ function theme_table($variables) {
 
 /**
  * Preprocess variables for theme_table().
- * @todo: update this once merged with head, and table.twig.html updated.
+ * @todo: update this once merged with head, and table.html.twig updated.
  */
-function template_preprocess_table($variables) {
-  $header = $variables['header'];
+function template_preprocess_table(&$variables) {
+
+  // Table Attributes
+  $table_attributes = $variables['attributes'];
+  $is_sticky = $variables['sticky'];
+  $is_responsive = $variables['responsive'];
+  
+  // Table Child Elements
+  $headers = $variables['header'];
   $rows = $variables['rows'];
-  $attributes = $variables['attributes'];
   $colgroups = $variables['colgroups'];
-  $sticky = $variables['sticky'];
-  $responsive = $variables['responsive'];
-  $empty = $variables['empty'];
-
-  // Add sticky headers, if applicable.
-  if (count($header) && $sticky) {
-    drupal_add_library('system', 'drupal.tableheader');
-    // Add 'sticky-enabled' class to the table to identify it for JS.
-    // This is needed to target tables constructed by this function.
-    $attributes['class'][] = 'sticky-enabled';
-  }
-  // If the table has headers and it should react responsively to columns hidden
-  // with the classes represented by the constants RESPONSIVE_PRIORITY_MEDIUM
-  // and RESPONSIVE_PRIORITY_LOW, add the tableresponsive behaviors.
-  if (count($header) && $responsive) {
-    drupal_add_library('system', 'drupal.tableresponsive');
-    // Add 'responsive-enabled' class to the table to identify it for JS.
-    // This is needed to target tables constructed by this function.
-    $attributes['class'][] = 'responsive-enabled';
+  
+  // Empty Message
+  $empty_message = $variables['empty'];
+
+  
+  if (!empty($headers)) {
+    // Add sticky headers, if applicable.
+    if ($is_sticky) {
+      drupal_add_library('system', 'drupal.tableheader');
+      // Add 'sticky-enabled' class to the table to identify it for JS.
+      // This is needed to target tables constructed by this function.
+      $table_attributes['class'][] = 'sticky-enabled';
+    }
+
+    // If the table has headers and it should react responsively to columns hidden
+    // with the classes represented by the constants RESPONSIVE_PRIORITY_MEDIUM
+    // and RESPONSIVE_PRIORITY_LOW, add the tableresponsive behaviors.
+    if ($is_responsive) {
+      drupal_add_library('system', 'drupal.tableresponsive');
+      // Add 'responsive-enabled' class to the table to identify it for JS.
+      // This is needed to target tables constructed by this function.
+      $table_attributes['class'][] = 'responsive-enabled';
+    }
   }
 
   // Format the table columns:
-  if (count($colgroups)) {
+  if (!empty($colgroups)) {
     $variables['colgroups'] = array();
     foreach ($colgroups as $number => $colgroup) {
       $variables['colgroups'][$number] = array();
-      $attributes = array();
+      $colgroup_attributes = array();
 
-      // Check if we're dealing with a simple or complex column
+      // Check if we're dealing with a simple or complex colgroup
       if (isset($colgroup['data'])) {
         foreach ($colgroup as $key => $value) {
           if ($key == 'data') {
             $cols = $value;
           }
           else {
-            $attributes[$key] = $value;
+            $colgroup_attributes[$key] = $value;
           }
         }
       }
@@ -2312,20 +2208,24 @@ function template_preprocess_table($variables) {
       }
 
       // Build colgroup
-      $variables['colgroups'][$number]['attributes'] = new Attribute($attributes);
-      if (is_array($cols) && count($cols)) {
-        $i = 0;
-        foreach ($cols as $key => $col) {
-          $variables['colgroups'][$number][$key] = array('attributes' => new Attribute($col));
+      $variables['colgroups'][$number]['attributes'] = new Attribute($colgroup_attributes);
+
+      // Build cols within colgroup
+      if (is_array($cols) && !empty($cols)) {
+        $variables['colgroups'][$number]['cols'] = array();
+        foreach ($cols as $col_key => $col) {
+          $col_attributes = new Attribute($col);
+          $variables['colgroups'][$number]['cols'][$col_key]['attributes'] = $col_attributes;
         }
       }
     }
   }
 
   // Add the 'empty' row message if available.
-  if (!count($rows) && $empty) {
+  // @todo  Removed Let the Theme template do this and don't change the # of rows
+  if (empty($rows) && !empty($empty_message)) {
     $header_count = 0;
-    foreach ($header as $header_cell) {
+    foreach ($headers as $header_cell) {
       if (is_array($header_cell)) {
         $header_count += isset($header_cell['colspan']) ? $header_cell['colspan'] : 1;
       }
@@ -2334,20 +2234,19 @@ function template_preprocess_table($variables) {
       }
     }
     $rows[] = array(array(
-        'data' => $empty,
-        'colspan' => $header_count,
-        'class' => array('empty', 'message'),
-      ));
+      'data' => $empty_message,
+      'colspan' => $header_count,
+      'class' => array('empty', 'message'),
+    ));
   }
 
-  $responsive = array();
+  $responsive_classes = array();
+
   // Format the table header:
-  if (count($header)) {
-    $ts = tablesort_init($header);
-    // HTML requires that the thead tag has tr tags in it followed by tbody
-    // tags. Using ternary operator to check and see if we have any rows.
+  if (!empty($headers)) {
+    $ts = tablesort_init($headers);
     $i = 0;
-    foreach ($header as $cell) {
+    foreach ($headers as $key => $cell) {
       $i++;
       // Track responsive classes for each column as needed. Only the header
       // cells for a column are marked up with the responsive classes by a
@@ -2355,14 +2254,27 @@ function template_preprocess_table($variables) {
       // must be transferred to the content cells.
       if (!empty($cell['class']) && is_array($cell['class'])) {
         if (in_array(RESPONSIVE_PRIORITY_MEDIUM, $cell['class'])) {
-          $responsive[$i] =  RESPONSIVE_PRIORITY_MEDIUM;
+          $responsive_classes[$i] = RESPONSIVE_PRIORITY_MEDIUM;
         }
         elseif (in_array(RESPONSIVE_PRIORITY_LOW, $cell['class'])) {
-          $responsive[$i] =  RESPONSIVE_PRIORITY_LOW;
+          $responsive_classes[$i] = RESPONSIVE_PRIORITY_LOW;
         }
       }
-      $cell = tablesort_header($cell, $header, $ts);
-      $header['cell'] = _theme_table_cell($cell, TRUE);
+
+      // If the cell is not an array, make it one 
+      if (!is_array($cell)) {
+        $cell = array('data' => $cell);
+      }
+
+      $cell = tablesort_header($cell, $headers, $ts);
+
+      // Tell the cell to be a header
+      $cell['header'] = TRUE;
+
+      // Convert to the format table_cell preprocesser will accept
+      $cell = array('cell' => $cell);
+
+      $headers[$key] = $cell;
     }
   }
   else {
@@ -2370,16 +2282,19 @@ function template_preprocess_table($variables) {
   }
 
   // Format the table rows:
-  if (count($rows)) {
-    $variables['rows'] = array();
+  if (!empty($rows)) {
+
+    // @todo replace this because zebras are for the zoo, see http://drupal.org/node/1649780
     $flip = array(
       'even' => 'odd',
       'odd' => 'even',
     );
     $class = 'even';
+
     foreach ($rows as $number => $row) {
-      $variables['rows'][$number] = array();
-      $attributes = array();
+
+      $row_attributes = array();
+      $cells = array();
 
       // Check if we're dealing with a simple or complex row
       if (isset($row['data'])) {
@@ -2388,48 +2303,66 @@ function template_preprocess_table($variables) {
             $cells = $value;
           }
           else {
-            $attributes[$key] = $value;
+            $row_attributes[$key] = $value;
           }
         }
       }
       else {
         $cells = $row;
       }
-      if (count($cells)) {
-        // Add odd/even class
-        if (empty($row['no_striping'])) {
-          $class = $flip[$class];
-          $attributes['class'][] = $class;
-        }
 
+      // @todo replace this because zebras are for the zoo, see http://drupal.org/node/1649780
+      // Add odd/even class
+      if (empty($row['no_striping'])) {
+        $class = $flip[$class];
+        $row_attributes['class'][] = $class;
+      }
+      
+
+      if (!empty($cells)) {
         // Build row
-        $variables['rows'][$number]['atttributes'] = new Attribute($attributes);
+        $variables['rows'][$number] = array(); 
+        $variables['rows'][$number]['attributes'] = new Attribute($row_attributes);
+        $variables['rows'][$number]['cells'] = array();
         $i = 0;
         foreach ($cells as $cell) {
           $i++;
+
+          // If the cell is not an array, make it one 
+          if (!is_array($cell)) {
+            $cell = array('data' => $cell);
+          }
+
           // Add active class if needed for sortable tables.
-          $cell = tablesort_cell($cell, $header, $ts, $i);
+          $cell = tablesort_cell($cell, $headers, $ts, $i);
+
           // Copy RESPONSIVE_PRIORITY_LOW/RESPONSIVE_PRIORITY_MEDIUM
           // class from header to cell as needed.
-          if (isset($responsive[$i])) {
+          if (isset($responsive_classes[$i])) {
             if (is_array($cell)) {
-              $cell['class'][] = $responsive[$i];
-            }
-            else {
-              $cell = array(
-                'data' => $cell,
-                'class' => $responsive[$i],
-              );
+              $cell['class'][] = $responsive_classes[$i];
             }
           }
-          $variables['rows']['cell'] = _theme_table_cell($cell);
+
+          // Add the cell to the row
+          $variables['rows'][$number]['cells'][$i] = array();
+          $variables['rows'][$number]['cells'][$i]['cell'] = $cell;
         }
       }
     }
   }
 
-  $variables['header'] = $header;
-  $variables['rows'] = $rows;
+  
+  // Set the table attributes
+  $variables['attributes'] = new Attribute($table_attributes);
+  
+  // Replace header with parsed header array
+  $variables['header'] = $headers;
+  
+  // Remove empty from template variables and set message to it's own variable 
+  // Not to conflict with twig's reserved keyword empty
+  unset($variables['empty']);
+  $variables['empty_message'] = $empty_message;
 }
 
 /**
@@ -2466,7 +2399,7 @@ function template_preprocess_tablesort_indicator(&$variables) {
     $variables['src'] = file_create_url('core/misc/arrow-desc.png');
     $attributes = array('width' => 13, 'height' => 13, 'alt' => t('sort descending'), 'title' => t('sort descending'));
   }
-    $variables['attributes'] = new Attribute($attributes);
+  $variables['attributes'] = new Attribute($attributes);
 }
 
 /**
@@ -2824,7 +2757,7 @@ function theme_meter($variables) {
   }
 
   $output = '<div' . new Attribute($attributes) . '>';
-  $output .= '  <div style="width: '. $variables['percentage'] .'%;" class="foreground"></div>';
+  $output .= '  <div style="width: ' . $variables['percentage'] . '%;" class="foreground"></div>';
   $output .= "</div>\n";
 
   if (!empty($variables['display_value'])) {
@@ -2881,54 +2814,77 @@ function theme_indentation($variables) {
  *
  * @return
  *   HTML for the cell.
+ *
+ * @todo remove this
  */
 function _theme_table_cell($cell, $header = FALSE) {
-  $attributes = '';
+  $is_header |= isset($cell['header']);
+  $data = (isset($cell['data'])) ? $cell['data'] : $cell;
+  $attributes = (isset($cell['attributes'])) ? $cell['attributes'] : '';
 
-  if (is_array($cell)) {
-    $data = isset($cell['data']) ? $cell['data'] : '';
-    // Cell's data property can be a string or a renderable array.
-    if (is_array($data)) {
-      $data = drupal_render($data);
-    }
-    $header |= isset($cell['header']);
-    unset($cell['data']);
-    unset($cell['header']);
-    $attributes = new Attribute($cell);
+  if ($is_header) {
+    $output = '<th' . $attributes . '>' . $data . '</th>';
   }
   else {
-    $data = $cell;
+    $output = '<td' . $attributes . '>' . $data . '</td>';
   }
 
-  if ($header) {
-    $output = "<th$attributes>$data</th>";
+  return $output;
+}
+
+/**
+ * Returns HTML for a table cell.
+ *
+ * @param $variables
+ *   An associative array containing:
+ *     header: Whether this cell is a header cell or not.
+ *     content: The cell content.
+ *     attributes: HTML attributes to apply to the cell.
+ *   
+ */
+function theme_table_cell($variables) {
+  $is_header = $variables['header'];
+  $content = (isset($variables['content'])) ? $variables['content'] : '';
+  $attributes = (isset($variables['attributes'])) ? $variables['attributes'] : '';
+
+  if ($is_header) {
+    $output = '<th' . $attributes . '>' . $content . '</th>';
   }
   else {
-    $output = "<td$attributes>$data</td>";
+    $output = '<td' . $attributes . '>' . $content . '</td>';
   }
-
   return $output;
 }
 
 /**
- * Preprocess variables for theme_table().
+ * Preprocess variables for theme_table_cell().
  */
 function template_preprocess_table_cell(&$variables) {
+
+  // Initialize variables needed by template
+  $variables['header'] = isset($variables['cell']['header']) || FALSE;
+  $variables['content'] = '';
+  $variables['attributes'] = new Attribute();
+
   // Cells can be arrays or strings.
-  if (is_array($variables['cell']) && !empty($variables['cell']['data'])) {
-    // The cell's data element can be a render array or a string.
-    if (is_array($variables['cell']['data'])) {
-      $variables['content'] = drupal_render($variables['cell']['data']);
-    }
-    else {
-      $variables['content'] = $variables['cell']['data'];
+  if (is_array($variables['cell']) ) {
+
+    if (isset($variables['cell']['data'])) {
+      // The cell's data element can be a render array or a string.
+      if (is_array($variables['cell']['data'])) {
+        $variables['content'] = drupal_render($variables['cell']['data']);
+      }
+      else {
+        $variables['content'] = $variables['cell']['data'];
+      }
+      // Unset the data element to avoid it appearing in the attributes.
+      unset($variables['cell']['data']);
     }
-    // Unset the data element to avoid it appearing in the attributes.
-    unset($variables['cell']['data']);
 
     // If the cell has a header element, set the header variable to its value.
     if (isset($variables['cell']['header'])) {
       $variables['header'] = $variables['cell']['header'];
+
       // Unset the header element to avoid it appearing in the attributes.
       unset($variables['cell']['header']);
     }
@@ -2937,8 +2893,12 @@ function template_preprocess_table_cell(&$variables) {
     $variables['attributes'] = new Attribute($variables['cell']);
   }
   else {
-    $variables['content'] = $variables['cell'];
+    $variables['content'] = $variables['data'];
   }
+  
+  // Remove cell because theme_table_cell doesn't need it
+  unset($variables['cell']);
+
 }
 
 /**
@@ -3534,7 +3494,7 @@ function drupal_common_theme() {
       'variables' => array('header' => NULL, 'rows' => NULL, 'attributes' => array(), 'caption' => NULL, 'colgroups' => array(), 'sticky' => TRUE, 'responsive' => TRUE, 'empty' => ''),
     ),
     'table_cell' => array(
-       'variables' => array('cell' => NULL, 'content' => NULL, 'header' => NULL),
+       'variables' => array('cell' => NULL, 'content' => NULL, 'header' => NULL, 'attributes' => array()),
     ),
     'meter' => array(
       'variables' => array('display_value' => NULL, 'form' => NULL, 'high' => NULL, 'low' => NULL, 'max' => NULL, 'min' => NULL, 'optimum' => NULL, 'value' => NULL, 'percentage' => NULL, 'attributes' => array()),
diff --git a/core/themes/stark/templates/theme.inc/table-cell.html.twig b/core/themes/stark/templates/theme.inc/table-cell.html.twig
index 092e39d..aee9fe7 100644
--- a/core/themes/stark/templates/theme.inc/table-cell.html.twig
+++ b/core/themes/stark/templates/theme.inc/table-cell.html.twig
@@ -5,7 +5,7 @@
  *
  * Available variables:
  * - header: Whether this cell is a header cell or not.
- * - cell: The cell content.
+ * - content: The cell content.
  * - attributes: HTML attributes to apply to the cell.
  *
  * @see template_preprocess
@@ -15,9 +15,8 @@
  * @ingroup themeable
  */
 #}
-{% if header is defined %}
-  <th{{ attributes }}>{{ content }}</th>
-{% else %}
-  <td{{ attributes }}>{{ content }}</td>
-{% endif %}
-
+<{{ header ? 'th' : 'td' }}{{ attributes }}>
+{%- if content -%}
+	{{ content }}
+{%- endif -%}
+</{{ header ? 'th' : 'td' }}>
\ No newline at end of file
diff --git a/core/themes/stark/templates/theme.inc/table.html.twig b/core/themes/stark/templates/theme.inc/table.html.twig
index 08de9bc..8dbcd49 100644
--- a/core/themes/stark/templates/theme.inc/table.html.twig
+++ b/core/themes/stark/templates/theme.inc/table.html.twig
@@ -28,7 +28,7 @@
  * - caption: A localized string to use for the <caption> tag.
  * - colgroups: An array of column groups.
  * - sticky: Use a "sticky" table header.
- * - empty: The message to display in an extra row if table does not have any rows.
+ * - empty_message: The message to display in an extra row if table does not have any rows.
  *
  * @see template_preprocess
  * @see template_preprocess_table
@@ -36,33 +36,46 @@
  * @ingroup themeable
  */
 #}
+
 <table{{ attributes }}>
   {% if caption %}
     <caption>{{ caption }}</caption>
   {% endif %}
 
-  {# @todo: add colgroups #}
-
+  {# Build the colgroup element. #}
+  {% if colgroups %}
+    {% for colgroup in colgroups %}
+     {% if colgroup.cols %}
+      <colgroup{{ colgroup.attributes }}>
+       {% for col in colgroup.cols %}
+         <col{{ col.attributes }}/>
+       {% endfor %}
+       </colgroup>
+     {% else %}
+      <colgroup{{ colgroup.attributes }}/>
+     {% endif %}
+   {% endfor %}
+ {% endif %}
+ 
   {# Build the table header. #}
-  {% if header|length %}
+  {% if header %}
     <thead><tr>
     {% for cell in header %}
-      {{ cell }}
+      {{ theme('table_cell', cell) }} {# no th here since this calls table_cell #}
     {% endfor %}
     </tr></thead>
   {% endif %}
 
   {# Build the table rows. #}
-  {% if rows|length %}
+  {% if rows %}
     <tbody>
     {% for row in rows %}
       <tr{{ row.attributes }}>
-      {% for cell in row %}
-        {{ cell }} {# no td here since this calls _theme_table_cell #}
+      {% for cell in row.cells %}
+        {{ theme('table_cell', cell) }} {# no td here since this calls table_cell #}
       {% endfor %}
       </tr>
     {% endfor %}
     </tbody>
   {% endif %}
 </table>
-
