Added a error message
Refactored