Jeremy Newman : update object to PHP 5 style, fix depreciated code