Cleanup: simplify ns emission code