use our own version of knapsack