Buffer accumulation and flushing added (issue #61)