Fixed #44: Ported code by @jrschumacher to master branch, changed the naming a bit, and implemented some helper methods and a build in stream wrapper listener.