Update README.md

Added full working example with error checking.