refactored the error messages