Pass length of packet as an argument