Fix minor typo.
Add error handlers into example code.
Adding a few tests.