Readd ip validation code.

Use `-a' option instead.
Cleaned some code.
Cleaned some more.