Adapt according to suggestions and add error handling