refactor ns