implement stream api