fixed example (tried to clarify the code, but had moved run to the wrong place.) It's late! :)
new features: fixes for #1, #2, #3, #4 and #5.