Buffering and flushing