Some refactoring on pipeStream.