chat ns refactoring