       # Buyer
       %{role: "buyer", bidded: bidded, bid: previous_bid, money: money, dealt: false} when not is_nil(money) and bid <= money ->
         data = remove_first(data, id, previous_bid, :highest_bid, :buyer_bids, &set_highest_bid/1)
+                |> update_bid(id, bid)
         if not is_nil(data.lowest_bid) and bid >= data.lowest_bid.bid do
-          deal(data, :lowest_bid, :seller_bids, id, bid, previous_bid, &set_lowest_bid/1)
+          deal(data, :lowest_bid, :seller_bids, id, bid, &set_lowest_bid/1)
         else
           bid(data, :highest_bid, :buyer_bids, id, bid, previous_bid, "NEW_BUYER_BIDS", fn most_bid, bid ->
             bid > most_bid

      data[bid_key]
    end
    data = %{data | key => bids, bid_key => most_bid}
    data = update_in(data, [:participants, id], fn participant ->
      %{participant | bidded: true, bid: bid}
    end)
    data
    |> Map.update!(:counter, fn x -> x + 1 end)
  end

      # Seller
      %{role: "seller", bidded: bidded, bid: previous_bid, money: money, dealt: false} when not is_nil(money) and bid >= money ->
        data = remove_first(data, id, previous_bid, :lowest_bid, :seller_bids, &set_lowest_bid/1)
                |> update_bid(id, bid)
        if not is_nil(data.highest_bid) and bid <= data.highest_bid.bid do
          deal(data, :highest_bid, :buyer_bids, id, bid, &set_highest_bid/1)
        else
          bid(data, :lowest_bid, :seller_bids, id, bid, previous_bid, "NEW_SELLER_BIDS", fn most_bid, bid ->
            bid < most_bid
