--- modules/patches/advpoll/modes/ranking.inc	2006-10-31 20:03:02.000000000 -0500
+++ modules/advpoll/modes/ranking.inc	2006-11-19 23:59:53.000000000 -0500
@@ -113,32 +113,36 @@
 			}
 		}
 		$output .= '</ol>';
+	}
 
     // XXX: debugging code
 		if (user_access('administer advanced poll') && $results->matrix) {
     	$output .= '<br />Internal values, for debugging purposes:';
     	// output the table of algorithm rounds
-    	$output .= '<table border="1"><tr><td>Round</td>';
-    	foreach ($node->choice as $choice) {
-      	$output .= '<td>' . check_plain($choice['label']) . '</td>';
-    	}
-    	$output .= '</tr>';
-    	$round = 1;
-			if (count($results->matrix) > 0) {
+	$header[0] = "Rounds";
+	$round = 1;
+	if (count($results->matrix) > 0) {
     		foreach ($results->matrix as $aRound) {
-      		$output .= "<tr><td>$round.</td>";
-      		foreach ($node->choice as $key => $choicename) {
-        		$output .= '<td>' . count($aRound[$key]) . '</td>';
-      		}
-      		$output .= '</tr>';
-      		$round++;
-    		}
-			}
-
-    	$output .= '</table>';
+			$header[$round] = $round;
+			$round++;
 		}
-
-    return $output;
+	}
+	
+	$round = 1;
+	$i = 0;
+	if (count($results->matrix) > 0) {
+    		foreach ($results->matrix as $aRound) {
+      			foreach ($node->choice as $key => $choicename) {
+				$rows[$i][0] = $choicename['label'];
+				$rows[$i][$round] = count($aRound[$key]);
+				$i++;
+      			}
+			$i=0;
+      			$round++;
+    		}
+	}
+	$output .= theme_table($header, $rows);
+    	return $output;
 	}
 }
 
