Update npv.rb

Minor refactor