PHP 5.3.3+ refactoring

Refactoring with the agreed structure.