Added support for IPv6 and multiple IP addresses