Additional error handling has been added