diff --git a/includes/theme.inc b/includes/theme.inc
index 9bd7062..1bb4bd3 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -312,6 +312,20 @@ function drupal_theme_rebuild() {
   cache_clear_all('theme_registry', 'cache', TRUE);
 }
 
+class renderElement {
+  function __construct(&$element, $key = NULL) {
+    $this->element = &$element;
+    $this->key = $key;
+  }
+  function __toString() {
+    if (!isset($this->rendered)) {
+      $rendered = isset($this->key) ? drupal_render($this->element[$this->key]) : drupal_render($this->element);
+      $this->rendered = $rendered ? $rendered : '';
+    }
+    return $this->rendered;
+  }
+}
+
 /**
  * Process a single implementation of hook_theme().
  *
@@ -934,7 +948,7 @@ function theme($hook, $variables = array()) {
     if (isset($info['path'])) {
       $template_file = $info['path'] . '/' . $template_file;
     }
-    $output = $render_function($template_file, $variables);
+    $output = $render_function($template_file, $variables, $info);
   }
 
   // restore path_to_theme()
@@ -1237,17 +1251,34 @@ function theme_get_setting($setting_name, $theme = NULL) {
  *   The filename of the template to render.
  * @param $variables
  *   A keyed array of variables that will appear in the output.
+ * @param $info
+ *   The info of the theme hook (optional).
  *
  * @return
  *   The output generated by the template.
  */
-function theme_render_template($template_file, $variables) {
+function theme_render_template($template_file, $variables, $info) {
+  if (isset($info['render element'])) {
+    $element = $variables[$info['render element']];
+    if (is_array($element)) {
+      foreach (element_children($element) as $key) {
+        if (!isset($variables[$key])) {
+          $variables[$key] = new renderElement($element, $key);
+        }
+      }
+      $variables['THE_REST'] = new renderElement($element);
+    }
+  }
   extract($variables, EXTR_SKIP);               // Extract the variables to a local namespace
   ob_start();                                   // Start output buffering
   include DRUPAL_ROOT . '/' . $template_file;   // Include the template file
   return ob_get_clean();                        // End buffering and return its contents
 }
 
+function blank($string) {
+  return ! (string) $string;
+}
+
 /**
  * Enable a given list of themes.
  *
diff --git a/themes/bartik/templates/page.tpl.php b/themes/bartik/templates/page.tpl.php
index 7b0f990..c671fba 100644
--- a/themes/bartik/templates/page.tpl.php
+++ b/themes/bartik/templates/page.tpl.php
@@ -120,7 +120,7 @@
       </div> <!-- /#name-and-slogan -->
     <?php endif; ?>
 
-    <?php print render($page['header']); ?>
+    <?php print $header; ?>
 
     <?php if ($main_menu): ?>
       <div id="main-menu" class="navigation">
@@ -164,9 +164,9 @@
     </div></div> <!-- /.section, /#messages -->
   <?php endif; ?>
 
-  <?php if ($page['featured']): ?>
+  <?php if (!blank($featured)): ?>
     <div id="featured"><div class="section clearfix">
-      <?php print render($page['featured']); ?>
+      <?php print $featured; ?>
     </div></div> <!-- /.section, /#featured -->
   <?php endif; ?>
 
@@ -176,14 +176,14 @@
       <div id="breadcrumb"><?php print $breadcrumb; ?></div>
     <?php endif; ?>
 
-    <?php if ($page['sidebar_first']): ?>
+    <?php if (!blank($sidebar_first)): ?>
       <div id="sidebar-first" class="column sidebar"><div class="section">
-        <?php print render($page['sidebar_first']); ?>
+        <?php print $sidebar_first; ?>
       </div></div> <!-- /.section, /#sidebar-first -->
     <?php endif; ?>
 
     <div id="content" class="column"><div class="section">
-      <?php if ($page['highlighted']): ?><div id="highlighted"><?php print render($page['highlighted']); ?></div><?php endif; ?>
+      <?php if (!blank($highlighted)): ?><div id="highlighted"><?php print $highlighted; ?></div><?php endif; ?>
       <a id="main-content"></a>
       <?php print render($title_prefix); ?>
       <?php if ($title): ?>
@@ -197,47 +197,47 @@
           <?php print render($tabs); ?>
         </div>
       <?php endif; ?>
-      <?php print render($page['help']); ?>
+      <?php print $help; ?>
       <?php if ($action_links): ?>
         <ul class="action-links">
           <?php print render($action_links); ?>
         </ul>
       <?php endif; ?>
-      <?php print render($page['content']); ?>
+      <?php print $content; ?>
       <?php print $feed_icons; ?>
 
     </div></div> <!-- /.section, /#content -->
 
-    <?php if ($page['sidebar_second']): ?>
+    <?php if (!blank($sidebar_second)): ?>
       <div id="sidebar-second" class="column sidebar"><div class="section">
-        <?php print render($page['sidebar_second']); ?>
+        <?php print $sidebar_second; ?>
       </div></div> <!-- /.section, /#sidebar-second -->
     <?php endif; ?>
 
   </div></div> <!-- /#main, /#main-wrapper -->
 
-  <?php if ($page['triptych_first'] || $page['triptych_middle'] || $page['triptych_last']): ?>
+  <?php if (!blank($triptych_first) || !blank($triptych_middle) || !blank($triptych_last)): ?>
     <div id="triptych-wrapper"><div id="triptych" class="clearfix">
-      <?php print render($page['triptych_first']); ?>
-      <?php print render($page['triptych_middle']); ?>
-      <?php print render($page['triptych_last']); ?>
+      <?php print $triptych_first; ?>
+      <?php print $triptych_middle; ?>
+      <?php print $triptych_last; ?>
     </div></div> <!-- /#triptych, /#triptych-wrapper -->
   <?php endif; ?>
 
   <div id="footer-wrapper"><div class="section">
 
-    <?php if ($page['footer_firstcolumn'] || $page['footer_secondcolumn'] || $page['footer_thirdcolumn'] || $page['footer_fourthcolumn']): ?>
+    <?php if (!blank($footer_firstcolumn) || !blank($footer_secondcolumn) || !blank($footer_thirdcolumn) || !blank($footer_fourthcolumn)): ?>
       <div id="footer-columns" class="clearfix">
-        <?php print render($page['footer_firstcolumn']); ?>
-        <?php print render($page['footer_secondcolumn']); ?>
-        <?php print render($page['footer_thirdcolumn']); ?>
-        <?php print render($page['footer_fourthcolumn']); ?>
+        <?php print $footer_firstcolumn; ?>
+        <?php print $footer_secondcolumn; ?>
+        <?php print $footer_thirdcolumn; ?>
+        <?php print $footer_fourthcolumn; ?>
       </div> <!-- /#footer-columns -->
     <?php endif; ?>
 
-    <?php if ($page['footer']): ?>
+    <?php if (!blank($footer)): ?>
       <div id="footer" class="clearfix">
-        <?php print render($page['footer']); ?>
+        <?php print $footer; ?>
       </div> <!-- /#footer -->
     <?php endif; ?>
 
