Added toArrayBuffer method