adding PHPDoc comments and fixing typos