working solution with performance issues at higher total prices, need to back test solution