Cleanup and docblocks. Fixed php references error.