edited npv function and added commentary