I might write some documentation for this if I get some free time later. Or you can do it for me.
Please note that this code is not well tested. So if you want to make use of it I recommend that you do some proper manual testing, or even better; write some more tests.