Refactor ip.h