Massive NS refactoring