Added a function for merging the two streams. Has some error