Update to latest libnpa and cleanup some code