Fully working example (hopefully). Though some kind of testing would be nice :-)