Fix names and add some PHPDoc.