Changed packet packing routine