Added missing code for the example to be standalone

Hi
This is some nice stuff you built. Unfortunately it took me 3 hours to make it run. I admit that I am a newbie but I think it is generally valid to have a copy-paste working example of your software.
I hope that you accept my critique and the pull request so that other people will find it easier to work with this nice piece of code with such a great design.