added compare; added more error messages