buffered pipe

Here ya go. I'm happy to make any fixes you want, or you can just take it and tweak it however you need to integrate it.