Improved way of pulling out the IP address