public function drawPage()
    {
        $this->preFlight();
        if ($this->preprocess()) {

            if ($this->window_dressing) {
                echo $this->getHeader();
            }
            
            if ($this->readinessCheck() !== false) {
                $body = $this->bodyContent();
            } else {
                $body = $this->errorContent();
            }

            if ($this->window_dressing) {
                echo $body;
                echo $this->getFooter();
            } else {
                $body = str_ireplace('</html>','',$body);
                $body = str_ireplace('</body>','',$body);
                echo $body;
            }

            $this->writeJS();
            
            echo array_reduce($this->css_files,
                function ($carry, $css_url) {
                    return $carry . sprintf('<link rel="stylesheet" type="text/css" href="%s">' . "\n",
                                    $css_url);
                },
                ''
            );
            
            $page_css = $this->css_content();
            if (!empty($page_css)) {
                echo '<style type="text/css">';
                echo $page_css;
                echo '</style>';
            }

            $this->postFlight();

            echo '</body></html>';
        } else {
            $this->postFlight();
        }
    }