Another revision, included some light phpdoc.