Add proper error handling, and new example file to illustrate
Improve dependency injection examples