Fix examples

* Fixed several bugs introduced by recent changes to the API
* Overall improvements to examples
* More consistent code style

=> We should definitely consider to let Travis run each of the examples. I'll open another pull request for this.