First pass of code cleanup for PHP 5 OO