Cleanup code, fixed PHPDoc