Add packet handler code