Made code more semantic and expressive
Add unit test with PHPUnit