More refactoring of nme tool