added logic for use with npm n module