protected function findController($object)
    {
        // Get the next URL argument
        $urlargs = $this->arguments;
        $arg = $urlargs->shift();

        // Store it as controller name
        $controller = $arg;
        
        // Strip any suffix
        if (($pos = strpos($controller, '.')) !== false)
            $controller = substr($controller, 0, $pos);
        
        // Check if the method exists
        if (!method_exists($object, $controller))
        {
            // Fall back to an index method
            if (method_exists($object, "index"))
            {
                if ($controller !== null)
                    $urlargs->unshift($arg);
                $controller = "index";
            }
            else
                throw new HTTPError(404, "Unknown controller: " . $controller);
        }
        return $controller;
    }