adding write-coalescing code