Removed some unused code and added some PHPDoc.