Remove useless code and sync with libnpa