added pack function