merge with datagram plugin code