Modifications to allow stream handling