further improved udp (not quite finished)