initial version of the p2 streaming algorithm