Updated to PHP 5.3 and added factory classes
Merged 5.3 branch