Move host-finding to library too