public function initialize()
    {
        if ($this->initialized) {
            throw new \Parable\Framework\Exception("App has already been initialized.");
        }

        // And now possible packages get their turn.
        $this->packageManager->registerPackages();

        $this->loadConfig();

        // Enable error reporting if debug is set to true
        if ($this->config->get('parable.debug') === true) {
            $this->setErrorReportingEnabled(true);
        } else {
            $this->setErrorReportingEnabled(false);
        }

        // Start the session if session.auto-enable is true
        if ($this->config->get('parable.session.auto-enable') !== false) {
            $this->startSession();
        }

        // Init the database if it's configured
        if ($this->config->get('parable.database.type')) {
            $this->loadDatabase();
        }

        // Set the basePath on the url based on the config
        if ($this->config->get('parable.app.homedir')) {
            $homedir = trim($this->config->get('parable.app.homedir'), DS);
            $this->url->setBasePath($homedir);
        }

        // See if there's any inits defined in the config
        if ($this->config->get('parable.inits')) {
            $this->loadInits();
        }

        // Set the default timezone if it's set
        if ($this->config->get('parable.timezone')) {
            date_default_timezone_set($this->config->get('parable.timezone'));
        }

        // Build the base Url
        $this->url->buildBaseurl();

        // Load the routes
        $this->loadRoutes();

        // And set the class to initialized
        $this->initialized = true;

        return $this;
    }