Code to handle batches of IPs