reworked method to get external ip.