modified to accept ips and hosts