Customizing the way of merging streams