revamp stream function
adjust stream test