fixing typos and adding PHPDoc