Adding unit tests and phpdocs