Clean up IP implementation.
Simplify IP.