refactor code to separate between core and nuep