protected function buildTemplateIndex()
    {
        // We'll iterate the template paths and find
        // any routable templates. Note that if there is
        // more than one directory, the earlier directories
        // are checked first, then on down the stack to
        // mimic the behavior of Twig_Loader_Filesystem.

        if (false === $this->templateIndexBuilt) {
            foreach ($this->templatePath as $path) {
                $dir = new \RecursiveDirectoryIterator($path);
                $it = new \RecursiveIteratorIterator($dir);

                foreach ($it as $template_file) {
                    if ($this->validateTemplate($template_file)) {

                        // Strip the path from the template file relative to
                        // the root template directory to get the template "route"
                        $template_full_path = $template_file->getPathname();
                        $template_rel_path = str_replace($path, '', $template_full_path);
                        $template_route = '/' . $template_rel_path;

                        if (!array_key_exists($template_route, $this->templateIndex)) {
                            $this->debug(sprintf('buildTemplateIndex: Routable Template %s Found at %s.', $template_rel_path, $template_full_path));

                            $template = new Template($template_rel_path, $template_full_path);
                            $this->templateIndex[$template_route] = $template;
                        }
                    }
                }
            }

            $this->templateIndexBuilt = true;
        }
    }