more refactoring in nlp package