Refactor common code, push into npr_utils