added documentation for `compare` method