refactor LookupDNS into a reusable func