refactor the nme functions into their own file