Adding an error handling.