Move some code into new "libnihif"