Update examples to display good practices and add handlers for all the possible
"error" events.
Merge pull request #3 from Kami/update_examples

Update example