refactored error handling, updated README