moving functions to ns