Revert "Removed some dead code."

This reverts commit 83245e8b0ba23e6f74d91ca45275d4ceb49c4632.
Removed duplicate code from core ns.