diff --git a/chessboard_render.php b/chessboard_render.php
index 67452cb..9a123ce 100644
--- a/chessboard_render.php
+++ b/chessboard_render.php
@@ -28,37 +28,39 @@ function template_preprocess_chessboard(&$variables) {
     // Construct the translation table
 
     // Empty and marked squares
-    $table_xhtml = array(
-      '-0' => theme('image', array('path' => $image_directory_path . '/' . chessboard_piece_filename('-', 0), 'width' => $size_attributes['square']['width'], 'height' => $size_attributes['square']['height'], 'alt' => '-', 'title' => '', 'attributes' => $class_attributes['square'])),
-      '-1' => theme('image', array('path' => $image_directory_path . '/' . chessboard_piece_filename('-', 1), 'width' => $size_attributes['square']['width'], 'height' => $size_attributes['square']['height'], 'alt' => '-',  'title' => '', 'attributes' => $class_attributes['square'])),
-      'x0' => theme('image', array('path' => $image_directory_path . '/' . chessboard_piece_filename('x', 0), 'width' => $size_attributes['square']['width'], 'height' => $size_attributes['square']['height'], 'alt' => 'x', 'title' => '', 'attributes' => $class_attributes['square'])),
-      'x1' => theme('image', array('path' => $image_directory_path . '/' . chessboard_piece_filename('x', 1), 'width' => $size_attributes['square']['width'], 'height' => $size_attributes['square']['height'], 'alt' => 'x', 'title' => '', 'attributes' => $class_attributes['square'])),
+    $table_tiles = array(
+      '-0' => array('#theme' => 'image', '#path' => $image_directory_path . '/' . chessboard_piece_filename('-', 0), '#width' => $size_attributes['square']['width'], '#height' => $size_attributes['square']['height'], '#alt' => '-', '#title' => '', '#attributes' => $class_attributes['square']),
+      '-1' => array('#theme' => 'image', '#path' => $image_directory_path . '/' . chessboard_piece_filename('-', 1), '#width' => $size_attributes['square']['width'], '#height' => $size_attributes['square']['height'], '#alt' => '-', '#title' => '', '#attributes' => $class_attributes['square']),
+      'x0' => array('#theme' => 'image', '#path' => $image_directory_path . '/' . chessboard_piece_filename('x', 0), '#width' => $size_attributes['square']['width'], '#height' => $size_attributes['square']['height'], '#alt' => 'x', '#title' => '', '#attributes' => $class_attributes['square']),
+      'x1' => array('#theme' => 'image', '#path' => $image_directory_path . '/' . chessboard_piece_filename('x', 1), '#width' => $size_attributes['square']['width'], '#height' => $size_attributes['square']['height'], '#alt' => 'x', '#title' => '', '#attributes' => $class_attributes['square']),
     );
 
     // Pieces
     $pieces = 'kqbnrp';
     for ($i=0; $i<6; $i++) {
       $piece = $pieces[$i];
-      $table_xhtml += array(
-        strtoupper($piece) . '0' => theme('image', array('path' => $image_directory_path . '/' . chessboard_piece_filename(strtoupper($piece), 0), 'width' => $size_attributes['square']['width'], 'height' => $size_attributes['square']['height'], 'alt' => strtoupper($piece), 'title' => '', 'attributes' => $class_attributes['square'])),
-        strtoupper($piece) . '1' => theme('image', array('path' => $image_directory_path . '/' . chessboard_piece_filename(strtoupper($piece), 1), 'width' => $size_attributes['square']['width'], 'height' => $size_attributes['square']['height'], 'alt' => strtoupper($piece), 'title' => '', 'attributes' => $class_attributes['square'])),
-        $piece . '0' => theme('image', array('path' => $image_directory_path . '/' . chessboard_piece_filename($piece, 0), 'width' => $size_attributes['square']['width'], 'height' => $size_attributes['square']['height'], 'alt' => $piece, 'title' => '', 'attributes' => $class_attributes['square'])),
-        $piece . '1' => theme('image', array('path' => $image_directory_path . '/' . chessboard_piece_filename($piece, 1), 'width' => $size_attributes['square']['width'], 'height' => $size_attributes['square']['height'], 'alt' => $piece, 'title' => '', 'attributes' => $class_attributes['square'])),
+      $table_tiles += array(
+        strtoupper($piece) . '0' => array('#theme' => 'image', '#path' => $image_directory_path . '/' . chessboard_piece_filename(strtoupper($piece), 0), '#width' => $size_attributes['square']['width'], '#height' => $size_attributes['square']['height'], '#alt' => strtoupper($piece), '#title' => '', '#attributes' => $class_attributes['square']),
+        strtoupper($piece) . '1' => array('#theme' => 'image', '#path' => $image_directory_path . '/' . chessboard_piece_filename(strtoupper($piece), 1), '#width' => $size_attributes['square']['width'], '#height' => $size_attributes['square']['height'], '#alt' => strtoupper($piece), '#title' => '', '#attributes' => $class_attributes['square']),
+        $piece . '0' => array('#theme' => 'image', '#path' => $image_directory_path . '/' . chessboard_piece_filename($piece, 0), '#width' => $size_attributes['square']['width'], '#height' => $size_attributes['square']['height'], '#alt' => $piece, '#title' => '', '#attributes' => $class_attributes['square']),
+        $piece . '1' => array('#theme' => 'image', '#path' => $image_directory_path . '/' . chessboard_piece_filename($piece, 1), '#width' => $size_attributes['square']['width'], '#height' => $size_attributes['square']['height'], '#alt' => $piece, '#title' => '', '#attributes' => $class_attributes['square']),
       );
     }
 
     // Borders
-    $table_xhtml += array(
-      'T' => theme('image', array('path' => $image_directory_path . '/' . chessboard_border_filename('T'), 'width' => $size_attributes['border-h']['width'], 'height' => $size_attributes['border-h']['height'], 'title' => '', 'attributes' => $class_attributes['border-h'])),
-      'B' => theme('image', array('path' => $image_directory_path . '/' . chessboard_border_filename('B'), 'width' => $size_attributes['border-h']['width'], 'height' => $size_attributes['border-h']['height'], 'title' => '', 'attributes' => $class_attributes['border-h'])),
-      'L' => theme('image', array('path' => $image_directory_path . '/' . chessboard_border_filename('L'), 'width' => $size_attributes['border-v']['width'], 'height' => $size_attributes['border-v']['height'], 'title' => '', 'attributes' => $class_attributes['border-v'])),
-      'R' => theme('image', array('path' => $image_directory_path . '/' . chessboard_border_filename('R'), 'width' => $size_attributes['border-v']['width'], 'height' => $size_attributes['border-v']['height'], 'title' => '', 'attributes' => $class_attributes['border-v'])),
-      'TL' => theme('image', array('path' => $image_directory_path . '/' . chessboard_border_filename('TL'), 'width' => $size_attributes['border-c']['width'], 'height' => $size_attributes['border-c']['height'], 'title' => '', 'attributes' => $class_attributes['border-c'])),
-      'TR' => theme('image', array('path' => $image_directory_path . '/' . chessboard_border_filename('TR'), 'width' => $size_attributes['border-c']['width'], 'height' => $size_attributes['border-c']['height'], 'title' => '', 'attributes' => $class_attributes['border-c'])),
-      'BL' => theme('image', array('path' => $image_directory_path . '/' . chessboard_border_filename('BL'), 'width' => $size_attributes['border-c']['width'], 'height' => $size_attributes['border-c']['height'], 'title' => '', 'attributes' => $class_attributes['border-c'])),
-      'BR' => theme('image', array('path' => $image_directory_path . '/' . chessboard_border_filename('BR'), 'width' => $size_attributes['border-c']['width'], 'height' => $size_attributes['border-c']['height'], 'title' => '', 'attributes' => $class_attributes['border-c'])),
+    $table_tiles += array(
+      'T' => array('#theme' => 'image', '#path' => $image_directory_path . '/' . chessboard_border_filename('T'), '#width' => $size_attributes['border-h']['width'], '#height' => $size_attributes['border-h']['height'], '#title' => '', '#attributes' => $class_attributes['border-h']),
+      'B' => array('#theme' => 'image', '#path' => $image_directory_path . '/' . chessboard_border_filename('B'), '#width' => $size_attributes['border-h']['width'], '#height' => $size_attributes['border-h']['height'], '#title' => '', '#attributes' => $class_attributes['border-h']),
+      'L' => array('#theme' => 'image', '#path' => $image_directory_path . '/' . chessboard_border_filename('L'), '#width' => $size_attributes['border-v']['width'], '#height' => $size_attributes['border-v']['height'], '#title' => '', '#attributes' => $class_attributes['border-v']),
+      'R' => array('#theme' => 'image', '#path' => $image_directory_path . '/' . chessboard_border_filename('R'), '#width' => $size_attributes['border-v']['width'], '#height' => $size_attributes['border-v']['height'], '#title' => '', '#attributes' => $class_attributes['border-v']),
+      'TL' => array('#theme' => 'image', '#path' => $image_directory_path . '/' . chessboard_border_filename('TL'), '#width' => $size_attributes['border-c']['width'], '#height' => $size_attributes['border-c']['height'], '#title' => '', '#attributes' => $class_attributes['border-c']),
+      'TR' => array('#theme' => 'image', '#path' => $image_directory_path . '/' . chessboard_border_filename('TR'), '#width' => $size_attributes['border-c']['width'], '#height' => $size_attributes['border-c']['height'], '#title' => '', '#attributes' => $class_attributes['border-c']),
+      'BL' => array('#theme' => 'image', '#path' => $image_directory_path . '/' . chessboard_border_filename('BL'), '#width' => $size_attributes['border-c']['width'], '#height' => $size_attributes['border-c']['height'], '#title' => '', '#attributes' => $class_attributes['border-c']),
+      'BR' => array('#theme' => 'image', '#path' => $image_directory_path . '/' . chessboard_border_filename('BR'), '#width' => $size_attributes['border-c']['width'], '#height' => $size_attributes['border-c']['height'], '#title' => '', '#attributes' => $class_attributes['border-c']),
     );
-    $tables_xhtml[$image_directory_path] = $table_xhtml;
+    foreach($table_tiles as $code => $tile) {
+      $tables_xhtml[$image_directory_path][$code] = drupal_render($tile);
+    }
   }
   $variables['table_xhtml'] = $tables_xhtml[$image_directory_path];
   // For convenience.
