pack function