Adding phpdoc comments as well as fixed a couple of tests