code chunks for packet proc