added comparing method and tests