Simplified notation parsing and other cosmetic fixes
diff --git a/system/core/Input.php b/system/core/Input.php
index 6ee1320..d707fe2 100644
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -153,53 +153,38 @@
 	 */
 	protected function _fetch_from_array(&$array, $index = '', $xss_clean = FALSE)
 	{
-		$value = NULL;
-
 		if (isset($array[$index]))
 		{
 			$value = $array[$index];
 		}
-		elseif(preg_match('/\[[^]]*\]$/', $index))		// Does the index contain array notation
+		elseif (($count = preg_match_all('/(?:^[^\[]+)|\[[^]]*\]/', $index, $matches)) > 1)		// Does the index contain array notation
 		{
-			$key = $index;
 			$container = $array;
-			
-			// Test if the $index is an array name, and try to obtain the final index
-			if (preg_match_all('/\[(.*?)\]/', $index, $matches))
+			for ($i = 0; $i < $count; $i++)
 			{
-				sscanf($index, '%[^[][', $key);
-				for ($i = 0, $c = count($matches[0]); $i < $c; $i++)
+				$key = trim($matches[0][$i], '[]');
+				if($key === '')			// The array notation will return the value as array
 				{
-					if($matches[1][$i] === '')			// The array notation will return the value as array
-					{
-						break;
-					}
-					if (isset($container[$key]))
-					{
-						$container = $container[$key];
-						$key = $matches[1][$i];
-					}
-					else
-					{
-						$container = array();
-						break;
-					}
+					break;
 				}
-
-				// Check if the deepest container has the field
-				if(isset($container[$key]))
+				if (isset($container[$key]))
 				{
-					$value = $container[$key];
+					$value = $container = $container[$key];
+				}
+				else
+				{
+					return NULL;
 				}
 			}
 		}
-
-		if ($xss_clean === TRUE)
+		else
 		{
-			return $this->security->xss_clean($value);
+			return NULL;
 		}
 
-		return $value;
+		return ($xss_clean === TRUE)
+			? $this->security->xss_clean($value)
+			: $value;
 	}
 
 	// --------------------------------------------------------------------
diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php
index 2238af9..443a06a 100644
--- a/system/helpers/form_helper.php
+++ b/system/helpers/form_helper.php
@@ -647,7 +647,8 @@
 			return form_prep($OBJ->set_value($field, $default), $is_textarea);
 		}
 
-		if (FALSE !== ($OBJ =& _get_input_object()) && ($value = $OBJ->post($field, FALSE)))
+		$CI =& get_instance();
+		if (NULL !== ($value = $CI->input->post($field, FALSE)))
 		{
 			return form_prep($value, $is_textarea);
 		}
@@ -1007,36 +1008,5 @@
 	}
 }
 
-// ------------------------------------------------------------------------
-
-if ( ! function_exists('_get_input_object'))
-{
-	/**
-	 * Input Object
-	 *
-	 * Fetches the input object
-	 *
-	 * @return	mixed
-	 */
-	function &_get_input_object()
-	{
-		$CI =& get_instance();
-
-		// We set this as a variable since we're returning by reference.
-		$return = FALSE;
-
-		if ( ! isset($CI->input) OR ! is_object($CI->input))
-		{
-			return $return;
-		}
-		else
-		{
-			$return = $CI->input;
-		}
-		
-		return $return;
-	}
-}
-
 /* End of file form_helper.php */
 /* Location: ./system/helpers/form_helper.php */
\ No newline at end of file