Corrected lots of PHPDoc documentation and made a few trivial changes to the code.