Added initial support for streams, though its buggy