knapsack fix and cleanup, added example