simplified api with a full pack function and a preallocated unpack function