Removed global variable, make use of PHP 5.3.0 lambda expressions.