Simplified flushing
Added support for buffering and flush to make the response less fragmented when streaming