Improve core/CodeIgniter.php
diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php
index 5152073..e3d8188 100755
--- a/system/core/CodeIgniter.php
+++ b/system/core/CodeIgniter.php
@@ -1,13 +1,13 @@
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
 /**
  * CodeIgniter
  *
  * An open source application development framework for PHP 5.1.6 or newer
  *
  * NOTICE OF LICENSE
- * 
+ *
  * Licensed under the Open Software License version 3.0
- * 
+ *
  * This source file is subject to the Open Software License (OSL 3.0) that is
  * bundled with this package in the files license.txt / license.rst.  It is
  * also available through the world wide web at this URL:
@@ -91,7 +91,7 @@
  * "libraries" folder. Since CI allows config items to be
  * overriden via data set in the main index. php file,
  * before proceeding we need to know if a subclass_prefix
- * override exists.  If so, we will set this value now,
+ * override exists. If so, we will set this value now,
  * before any classes are loaded
  * Note: Since the config file data is cached it doesn't
  * hurt to load it here.
@@ -106,13 +106,10 @@
  *  Set a liberal script execution time limit
  * ------------------------------------------------------
  */
-	if (function_exists("set_time_limit") AND @ini_get("safe_mode") == 0)
+	if (function_exists('set_time_limit') AND @ini_get('safe_mode') == 0
+		AND php_sapi_name() !== 'cli') // Do not override the Time Limit value if running from Command Line
 	{
-		// Do not override the Time Limit value if running from Command Line
-		if(php_sapi_name() != 'cli')
-		{
-			@set_time_limit(300);
-		}
+		@set_time_limit(300);
 	}
 
 /*
@@ -162,7 +159,6 @@
  * after the Config class is instantiated.
  *
  */
-
 	$UNI =& load_class('Utf8', 'core');
 
 /*
@@ -195,15 +191,13 @@
 
 /*
  * ------------------------------------------------------
- *	Is there a valid cache file?  If so, we're done...
+ *	Is there a valid cache file? If so, we're done...
  * ------------------------------------------------------
  */
-	if ($EXT->_call_hook('cache_override') === FALSE)
+	if ($EXT->_call_hook('cache_override') === FALSE
+		AND $OUT->_display_cache($CFG, $URI) == TRUE)
 	{
-		if ($OUT->_display_cache($CFG, $URI) == TRUE)
-		{
-			exit;
-		}
+		exit;
 	}
 
 /*
@@ -273,13 +267,13 @@
 	$method = $RTR->fetch_method();
 
 	if ( ! class_exists($class)
-		OR strncmp($method, '_', 1) == 0
+		OR strpos($method, '_', 1) === 0
 		OR in_array(strtolower($method), array_map('strtolower', get_class_methods('CI_Controller')))
 		)
 	{
 		if ( ! empty($RTR->routes['404_override']))
 		{
-			$x = explode('/', $RTR->routes['404_override']);
+			$x = explode('/', $RTR->routes['404_override'], 2);
 			$class = $x[0];
 			$method = (isset($x[1]) ? $x[1] : 'index');
 			if ( ! class_exists($class))
@@ -341,7 +335,7 @@
 			// Check and see if we are using a 404 override and use it.
 			if ( ! empty($RTR->routes['404_override']))
 			{
-				$x = explode('/', $RTR->routes['404_override']);
+				$x = explode('/', $RTR->routes['404_override'], 2);
 				$class = $x[0];
 				$method = (isset($x[1]) ? $x[1] : 'index');
 				if ( ! class_exists($class))
@@ -367,7 +361,6 @@
 		call_user_func_array(array(&$CI, $method), array_slice($URI->rsegments, 2));
 	}
 
-
 	// Mark a benchmark end point
 	$BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_end');
 
@@ -405,6 +398,5 @@
 		$CI->db->close();
 	}
 
-
 /* End of file CodeIgniter.php */
-/* Location: ./system/core/CodeIgniter.php */
\ No newline at end of file
+/* Location: ./system/core/CodeIgniter.php */