Added function for flattening streams of streams