refactor N