splint packing logic as PackTemplate
split unpacking logic