private function _createInstance($namespace, $class, $params, $method_name, $data)
    {
        $ns_class = $namespace . $class;

        //create a reflection class so that we can pass parameters to the constructor

        $ref_class = new \ReflectionClass($ns_class);

        if (is_array($params) && sizeof($params) > 0) {

            $instance = $ref_class->newInstanceArgs($params);

        } else {

            $instance = new $ns_class();
        }
        
        $this->logger->info("$namespace object created for $class class");
   
        //call the method along with parameters, if they exist !
        if (method_exists($instance, $method_name))
        {
            if(is_callable(array($instance, $method_name)))
            {
                $last_hook = $this->loading[count($this->loading) - 1];
                $this->loaderHooks($instance,"pre_$last_hook",$class,$method_name,$data);
                call_user_func_array(array($instance, $method_name), $data);
                $this->loaderHooks($instance,"post_$last_hook",$class,$method_name,$data);
            }
        }elseif(is_object($instance)) 
        {
            $last_hook = $this->loading[count($this->loading) - 1];
            $this->loaderHooks($instance,"pre_$last_hook",$class,$method_name,$data);
        }
        else if(strpos($namespace,'controller') > 0)
        {
            header("HTTP/1.0 404 Not Found");
            Base::getInstance()->hook('404',array(
                'file' => $ref_class,
                'controller' => $class,
                'method' => $method_name,
                'message' => '404'
            ));
            die();
        }

        $this->clearCurrentLoader();

        return $instance;
    }