handling code for every packet type except pinging