add main loop and refresh if ips change