diff --git a/views-secondary-row-view-table.tpl.php b/views-secondary-row-view-table.tpl.php
index 743d29a..a9abcd3 100644
--- a/views-secondary-row-view-table.tpl.php
+++ b/views-secondary-row-view-table.tpl.php
@@ -1,13 +1,14 @@
 <?php
+
 /**
- * @file views-secondary-row-view-table.tpl.php
+ * @file
  * Template to display a view as a table.
  *
  * - $title : The title of this group of rows.  May be empty.
  * - $header: An array of header labels keyed by field id.
  * - $header_classes: An array of header classes keyed by field id.
  * - $fields: An array of CSS IDs to use for each field id.
- * - $class: A class or classes to apply to the table, based on settings.
+ * - $classes: A class or classes to apply to the table, based on settings.
  * - $row_classes: An array of classes to apply to each row, indexed by row
  *   number. This matches the index in $rows.
  * - $rows: An array of row items. Each row is an array of content.
@@ -17,24 +18,26 @@
  * @ingroup views_templates
  */
 ?>
-<table class="<?php print $classes; ?>"<?php print $attributes; ?>>
+<table <?php if ($classes) { print 'class="'. $classes . '" '; } ?><?php print $attributes; ?>>
   <?php if (!empty($title)) : ?>
     <caption><?php print $title; ?></caption>
   <?php endif; ?>
-  <thead>
-    <tr>
-      <?php foreach ($header as $field => $label): ?>
-        <th class="<?php print $header_classes[$field]; ?>">
-          <?php print $label; ?>
-        </th>
-      <?php endforeach; ?>
-    </tr>
-  </thead>
+  <?php if (!empty($header)) : ?>
+    <thead>
+      <tr>
+        <?php foreach ($header as $field => $label): ?>
+          <th <?php if ($header_classes[$field]) { print 'class="'. $header_classes[$field] . '" '; } ?>>
+            <?php print $label; ?>
+          </th>
+        <?php endforeach; ?>
+      </tr>
+    </thead>
+  <?php endif; ?>
   <tbody>
-    <?php foreach ($rows as $count => $row): ?>
-      <tr class="<?php print implode(' ', $row_classes[$count]); ?>">
+    <?php foreach ($rows as $row_count => $row): ?>
+      <tr <?php if ($row_classes[$row_count]) { print 'class="' . implode(' ', $row_classes[$row_count]) .'"';  } ?>>
         <?php foreach ($row as $field => $content): ?>
-          <td class="<?php print $field_classes[$field][$count]; ?>" <?php print drupal_attributes($field_attributes[$field][$count]); ?>>
+          <td <?php if ($field_classes[$field][$row_count]) { print 'class="'. $field_classes[$field][$row_count] . '" '; } ?><?php print drupal_attributes($field_attributes[$field][$row_count]); ?>>
             <?php print $content; ?>
           </td>
         <?php endforeach; ?>
