Some code cleanup, added IPv6 address parsing.