Packet initialization function