Restructure pkt handle routine