Added support for streams, new unit tests