Improve html, inflector & language helpers
diff --git a/system/helpers/inflector_helper.php b/system/helpers/inflector_helper.php
index f093dd9..0bd1e11 100644
--- a/system/helpers/inflector_helper.php
+++ b/system/helpers/inflector_helper.php
@@ -1,4 +1,4 @@
-<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
 /**
  * CodeIgniter
  *
@@ -85,16 +85,7 @@
 			'/([^u])s$/'			=> '\1',
 		);
 
-		foreach ($singular_rules as $rule => $replacement)
-		{
-			if (preg_match($rule, $result))
-			{
-				$result = preg_replace($rule, $replacement, $result);
-				break;
-			}
-		}
-
-		return $result;
+		return preg_replace(array_keys($singular_values), $singular_values, $result);
 	}
 }
 
@@ -138,16 +129,7 @@
 			'/$/'						=> 's',
 		);
 
-		foreach ($plural_rules as $rule => $replacement)
-		{
-			if (preg_match($rule, $result))
-			{
-				$result = preg_replace($rule, $replacement, $result);
-				break;
-			}
-		}
-
-		return $result;
+		return preg_replace(array_keys($plural_rules), $plural_rules, $result);
 	}
 }
 
@@ -166,9 +148,7 @@
 {
 	function camelize($str)
 	{
-		$str = 'x'.strtolower(trim($str));
-		$str = ucwords(preg_replace('/[\s_]+/', ' ', $str));
-		return substr(str_replace(' ', '', $str), 1);
+		return substr(str_replace(' ', '', ucwords(preg_replace('/[\s_]+/', ' ', $str))), 1);
 	}
 }
 
@@ -212,4 +192,4 @@
 }
 
 /* End of file inflector_helper.php */
-/* Location: ./system/helpers/inflector_helper.php */
\ No newline at end of file
+/* Location: ./system/helpers/inflector_helper.php */