refactor of stream adapters