add more functions for working with paired streams
reorg source