fixed error handling and updated README.md