Refactored the error statements