static function Dispatch($phreezer,$renderEngine,$action='',$context=null,$router=null)
	{
		if ($router == null) {
			require_once('GenericRouter.php');
			$router = new GenericRouter();
		}

		// get the route and normalize the controller name
		list($controller_param,$method_param) = $router->GetRoute( $action );
		$controller_class = $controller_param."Controller";
	
		if (self::$FAST_LOOKUP) {

			if (!class_exists($controller_class)) {
				$controller_file = "Controller/$controller_class.php";
				include_once $controller_file;
			}
			
			$controller = new $controller_class($phreezer,$renderEngine,$context,$router);
			$controller->$method_param();
			
			return true;
		}
		
		
		// if the controller was in a sub-directory, get rid of the directory path
		$slashPos = strpos($controller_class,'/');
		while ($slashPos !== false)
		{
			$controller_class = substr($controller_class,$slashPos+1);
			$slashPos = strpos($controller_class,'/');
		}
		
		if (!class_exists($controller_class))
		{
			// attempt to locate the controller file
			$controller_file = "Controller/" . $controller_param . "Controller.php";
			$controller_filepath = null;
			
			// search for the controller file in the default locations, then the include path
			$paths = array_merge(
				array('./libs/','./'),
				explode(PATH_SEPARATOR,get_include_path())
			);
			
			$found = false;
			foreach ($paths as $path)
			{
				$controller_filepath = self::ControllerFileExists($path ."/".$controller_file);
				if ($controller_filepath)
				{
					$found = true;
					break;
				}
			}
	
			if (!$found) throw new Exception("File ~/libs/".$controller_file." was not found in include path");
	
			// convert any php errors into an exception
			if (self::$IGNORE_DEPRECATED)
			{
				ExceptionThrower::Start();
			}
			else
			{
				ExceptionThrower::Start(E_ALL);
				ExceptionThrower::$IGNORE_DEPRECATED = false;
			}
	
			// we should be fairly certain the file exists at this point
			include_once($controller_filepath);
	
			// we found the file but the expected class doesn't appear to be defined
			if (!class_exists($controller_class))
			{
				throw new Exception("Controller file was found, but class '".$controller_class."' is not defined");
			}
		}


		// create an instance of the controller class
		$controller = new $controller_class($phreezer,$renderEngine,$context,$router);
		
		// we have a valid instance, just verify there is a matching method
		if (!is_callable(array($controller, $method_param)))
		{
			throw new Exception("'".$controller_class.".".$method_param."' is not a valid action");
		}

		// do not call the requested method/route if the controller request has been cancelled
		if (!$controller->IsTerminated())
		{
			// file, class and method all are ok, go ahead and call it
			call_user_func(array(&$controller, $method_param));
		}

		// reset error handling back to whatever it was
		//restore_exception_handler();
		ExceptionThrower::Stop();

		return true;
	}