Used create_function() instead of anonymous functions for PHP 5.2 support