refactor buffer handling when writing/putting data for moar write-ops/sec and improved memory usage when inserting large values