replaced streams with chunks
streaming could be implemented as is