updated error handling, updated sample/readme