this has a bug whereby if the list of remote_ports is not the same size as the list of real matching ports, then the list of port names will be short, and port descriptions may be assigned to the wrong ports, or the query may crash. needs testing.