Refactor ip.h [not done yet]