Improved stream support and added it to public API.