Do some small refactoring to improve the readability. Now also the corresponding PHP Spec tests.