Upgraded the error handling statements