Cleaned up and added basic IPv6 support.