diff --git a/system/application/config/config.php b/system/application/config/config.php
index 0b4f33f..c33bda3 100644
--- a/system/application/config/config.php
+++ b/system/application/config/config.php
@@ -37,6 +37,8 @@
 | 'auto'			Default - auto detects
 | 'path_info'		Uses the PATH_INFO 
 | 'query_string'	Uses the QUERY_STRING
+| 'orig_path_info'	Uses the ORIG_PATH_INFO 
+| 'request_uri'		Uses the REQUEST_URI
 |
 */
 $config['uri_protocol']	= "auto";
diff --git a/system/application/config/routes.php b/system/application/config/routes.php
index 5167f75..dc8a32d 100644
--- a/system/application/config/routes.php
+++ b/system/application/config/routes.php
@@ -45,7 +45,8 @@
 
 // Define your own routes below -------------------------------------------
 
+$route['products/([a-z]+)/(\d+)'] = "bamo/$1/a$2";
 
-$route['products\/([a-z]+)\/(\d+)'] = "$1/a$2";
+
 
 ?>
\ No newline at end of file
diff --git a/system/codeigniter/CodeIgniter.php b/system/codeigniter/CodeIgniter.php
index de7f89a..872f4c0 100644
--- a/system/codeigniter/CodeIgniter.php
+++ b/system/codeigniter/CodeIgniter.php
@@ -27,7 +27,7 @@
  * @link		http://www.codeigniter.com/user_guide/
  */
  
-define('APPVER', '1.4');
+define('APPVER', '1.4.0');
 
 /*
  * ------------------------------------------------------
@@ -122,7 +122,7 @@
  * 
  */
  
-_load_class('CI_Loader'); 
+_load_class('CI_Loader', FALSE); 
   
 if (floor(phpversion()) < 5)
 {
@@ -133,7 +133,7 @@
 	require(BASEPATH.'codeigniter/Base5'.EXT);
 }
 
-_load_class('CI_Controller'); 
+_load_class('CI_Controller', FALSE); 
 
 require(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().EXT);
 
diff --git a/system/codeigniter/Common.php b/system/codeigniter/Common.php
index 2ec1c3d..4879e70 100644
--- a/system/codeigniter/Common.php
+++ b/system/codeigniter/Common.php
@@ -63,11 +63,10 @@
 		}
 		else
 		{
-			$objects[$class] = TRUE;
+			$objects[$class] = FALSE;
 		}
 	}
 	
-	
 	return $objects[$class];
 }
 
diff --git a/system/drivers/DB_mssql.php b/system/drivers/DB_mssql.php
index 6156ec3..48d1929 100644
--- a/system/drivers/DB_mssql.php
+++ b/system/drivers/DB_mssql.php
@@ -93,7 +93,7 @@
 	 * @param	string	an SQL query
 	 * @return	string
 	 */	
-    function &_prep_query($sql)
+    function _prep_query($sql)
     {
 		return $sql;
     }
diff --git a/system/drivers/DB_mysql.php b/system/drivers/DB_mysql.php
index 18c080b..82e677a 100644
--- a/system/drivers/DB_mysql.php
+++ b/system/drivers/DB_mysql.php
@@ -100,7 +100,7 @@
 	 * @param	string	an SQL query
 	 * @return	string
 	 */	
-    function &_prep_query($sql)
+    function _prep_query($sql)
     {
 		// "DELETE FROM TABLE" returns 0 affected rows This hack modifies 
 		// the query so that it returns the number of affected rows
diff --git a/system/drivers/DB_mysqli.php b/system/drivers/DB_mysqli.php
index f8cb19d..32c4c0f 100644
--- a/system/drivers/DB_mysqli.php
+++ b/system/drivers/DB_mysqli.php
@@ -102,7 +102,7 @@
 	 * @param	string	an SQL query
 	 * @return	string
 	 */	
-    function &_prep_query($sql)
+    function _prep_query($sql)
     {
 		// "DELETE FROM TABLE" returns 0 affected rows This hack modifies 
 		// the query so that it returns the number of affected rows
diff --git a/system/drivers/DB_odbc.php b/system/drivers/DB_odbc.php
index fac4490..50f39ac 100644
--- a/system/drivers/DB_odbc.php
+++ b/system/drivers/DB_odbc.php
@@ -94,7 +94,7 @@
 	 * @param	string	an SQL query
 	 * @return	string
 	 */	
-    function &_prep_query($sql)
+    function _prep_query($sql)
     {
 		return $sql;
     }
diff --git a/system/drivers/DB_postgre.php b/system/drivers/DB_postgre.php
index 01d4b3d..3829b04 100644
--- a/system/drivers/DB_postgre.php
+++ b/system/drivers/DB_postgre.php
@@ -94,7 +94,7 @@
 	 * @param	string	an SQL query
 	 * @return	string
 	 */	
-    function &_prep_query($sql)
+    function _prep_query($sql)
     {
 		return $sql;
     }
@@ -174,7 +174,7 @@
 		if ($table == '')
 			return '0';
 	
-		$query = $this->query("SELECT COUNT(*) AS numrows FROM `".$this->dbprefix.$table."`");
+		$query = $this->query("SELECT COUNT(*) AS numrows FROM ".$this->dbprefix.$table."");
 		
 		if ($query->num_rows() == 0)
 			return '0';
@@ -225,7 +225,7 @@
 	{
 		if (stristr($table, '.'))
 		{
-			$table = preg_replace("/\./", "`.`", $table);
+			$table = preg_replace("/\./", ".", $table);
 		}
 		
 		return $table;
@@ -432,7 +432,7 @@
 			$F->name 		= pg_field_name($this->result_id, $i);
 			$F->type 		= pg_field_type($this->result_id, $i);
 			$F->max_length	= pg_field_size($this->result_id, $i);
-			$F->primary_key = 0;
+			$F->primary_key = $i == 0;
 			$F->default		= '';
 
 			$retval[] = $F;
diff --git a/system/drivers/DB_sqlite.php b/system/drivers/DB_sqlite.php
index 6428dd5..1192e6d 100644
--- a/system/drivers/DB_sqlite.php
+++ b/system/drivers/DB_sqlite.php
@@ -115,7 +115,7 @@
 	 * @param	string	an SQL query
 	 * @return	string
 	 */	
-    function &_prep_query($sql)
+    function _prep_query($sql)
     {
 		return $sql;
     }
diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php
index f82ad01..d4e45a0 100644
--- a/system/helpers/form_helper.php
+++ b/system/helpers/form_helper.php
@@ -326,7 +326,7 @@
  */	
 function form_prep($str = '')
 {
-	if ($str == '')
+	if ($str === '')
 	{
 		return '';
 	}
diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php
index d2d2a59..03d6c3b 100644
--- a/system/helpers/url_helper.php
+++ b/system/helpers/url_helper.php
@@ -90,7 +90,7 @@
  */	
 function anchor($uri = '', $title = '', $attributes = '')
 {
-	$site_url = site_url($uri);
+	$site_url = ( ! preg_match('!^\w+://!i', $uri)) ? site_url($uri) : $uri;
 	
 	if ($title == '')
 	{
@@ -128,7 +128,7 @@
  */
 function anchor_popup($uri = '', $title = '', $attributes = FALSE)
 {	
-	$site_url = site_url($uri);
+	$site_url = ( ! preg_match('!^\w+://!i', $uri)) ? site_url($uri) : $uri;
 	
 	if ($title == '')
 	{
diff --git a/system/libraries/Calendar.php b/system/libraries/Calendar.php
index 013f067..b77dd1b 100644
--- a/system/libraries/Calendar.php
+++ b/system/libraries/Calendar.php
@@ -263,7 +263,7 @@
 		}
 		else
 		{
-			$month_names = array('01' => 'cal_january', '02' => 'cal_february', '03' => 'cal_march', '04' => 'cal_april', '05' => 'cal_mayl', '06' => 'cal_june', '07' => 'cal_july', '08' => 'cal_august', '09' => 'cal_september', '10' => 'cal_october', '11' => 'cal_novermber', '12' => 'cal_december');
+			$month_names = array('01' => 'cal_january', '02' => 'cal_february', '03' => 'cal_march', '04' => 'cal_april', '05' => 'cal_mayl', '06' => 'cal_june', '07' => 'cal_july', '08' => 'cal_august', '09' => 'cal_september', '10' => 'cal_october', '11' => 'cal_november', '12' => 'cal_december');
 		}
 		
 		$month = $month_names[$month];
diff --git a/system/libraries/Loader.php b/system/libraries/Loader.php
index e2467fa..3d2501f 100644
--- a/system/libraries/Loader.php
+++ b/system/libraries/Loader.php
@@ -478,7 +478,7 @@
 		if ($path == '')
 		{
 			$ext = pathinfo($view, PATHINFO_EXTENSION);
-			$file = ($ext == '') ? $view.EXT : $view;
+			$file = ($ext != EXT) ? $view.EXT : $view;
 			$path = $this->view_path.$file;
 		}
 		else
diff --git a/system/libraries/Router.php b/system/libraries/Router.php
index 6781454..b28ead9 100644
--- a/system/libraries/Router.php
+++ b/system/libraries/Router.php
@@ -87,25 +87,31 @@
 
 		// Fetch the URI string Depending on the server, 
 		// the URI will be available in one of two globals
-		switch ($this->config->item('uri_protocol'))
+		if ($this->config->item('uri_protocol') == 'auto')
 		{
-			case 'path_info'	: $this->uri_string = (isset($_SERVER['PATH_INFO'])) ? $_SERVER['PATH_INFO'] : @getenv('PATH_INFO');	
-				break;
-			case 'query_string' : $this->uri_string = (isset($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : @getenv('QUERY_STRING'); 
-				break;
-			default : 
-						$path_info = (isset($_SERVER['PATH_INFO'])) ? $_SERVER['PATH_INFO'] : @getenv('PATH_INFO');
-						
-						if ($path_info != '' AND $path_info != "/".SELF)
-						{
-							$this->uri_string = $path_info;
-						}
-						else
-						{
-							$this->uri_string = (isset($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : @getenv('QUERY_STRING');
-						}
-				break;
+			$path_info = getenv('PATH_INFO');
+			if ($path_info != '' AND $path_info != "/".SELF)
+			{
+				$this->uri_string = $path_info;
+			}
+			else
+			{
+				$path_info = getenv('ORIG_PATH_INFO');
+				if ($path_info != '' AND $path_info != "/".SELF)
+				{
+					$this->uri_string = $path_info;
+				}
+				else
+				{
+					$this->uri_string = getenv('QUERY_STRING');
+				}
+			}
 		}
+		else
+		{
+			$this->uri_string = getenv(strtoupper($this->config->item('uri_protocol')));		
+		}
+		
 	
 		// Is there a URI string? If not, the default controller specified 
 		// by the admin in the "routes" file will be shown.
@@ -291,10 +297,7 @@
 				
 		// Loop through the route array looking for wildcards
 		foreach (array_slice($this->routes, 1) as $key => $val)
-		{
-			if (count(explode('/', $key)) != $num)
-				continue;
-						
+		{						
 			// Convert wildcards to RegEx
 			$key = str_replace(':any', '.+', str_replace(':num', '[0-9]+', $key));
 			
diff --git a/system/libraries/URI.php b/system/libraries/URI.php
index 4c2fa9c..c5fd462 100644
--- a/system/libraries/URI.php
+++ b/system/libraries/URI.php
@@ -28,7 +28,7 @@
  */
 class CI_URI {
 
-	var $uri;
+	var $router;
 	var	$keyval	= array();
 
 	/**
@@ -42,7 +42,7 @@
 	 */		
 	function CI_URI()
 	{
-		$this->uri =& _load_class('CI_Router');		
+		$this->router =& _load_class('CI_Router');	
 		log_message('debug', "URI Class Initialized");
 	}
 	
@@ -60,7 +60,7 @@
 	 */
 	function segment($n, $no_result = FALSE)
 	{
-		return ( ! isset($this->uri->segments[$n])) ? $no_result : $this->uri->segments[$n];
+		return ( ! isset($this->router->segments[$n])) ? $no_result : $this->router->segments[$n];
 	}
 
 	// --------------------------------------------------------------------
@@ -196,7 +196,7 @@
 			$leading	= '/';
 			$trailing	= '/';
 		}
-		return ( ! isset($this->uri->segments[$n])) ? '' : $leading.$this->uri->segments[$n].$trailing;
+		return ( ! isset($this->router->segments[$n])) ? '' : $leading.$this->router->segments[$n].$trailing;
 	}
 	
 	// --------------------------------------------------------------------
@@ -209,7 +209,7 @@
 	 */
 	function segment_array()
 	{
-		return $this->uri->segments;
+		return $this->router->segments;
 	}
 	
 	// --------------------------------------------------------------------
@@ -222,7 +222,7 @@
 	 */
 	function total_segments()
 	{
-		return count($this->uri->segments);
+		return count($this->router->segments);
 	}
 	
 	// --------------------------------------------------------------------
@@ -235,7 +235,7 @@
 	 */
 	function uri_string()
 	{
-		return $this->uri->uri_string;
+		return $this->router->uri_string;
 	}
 
 }