Added support for streams and reading from stdin