Added comments to _write_to_buffer()