Implemented packing/unpacking and tests for these functions