redefin gift_commodity algorithm