update stream implementation from #3