Updated to work with PHP 5.6