nltpmd.c refactoring