Set CheckDNS timeout and cleaned up the code