packet_handler improved.