added support for streams and readers