Added support for streams and buffers