     end)
   end
 
+  def set_highest_bid(%{buyer_bids: []} = data) do
+    %{ data | highest_bid: nil }
+  end
+  def set_highest_bid(%{buyer_bids: bids} = data) do
+    %{ data | highest_bid: Enum.max_by(bids, &elem(&1, 1)) }
+  end
+
+  def set_lowest_bid(%{seller_bids: []} = data) do
+    %{ data | lowest_bid: nil }
+  end
+  def set_lowest_bid(%{seller_bids: bids} = data) do
+    %{ data | lowest_bid: Enum.min_by(bids, &elem(&1, 1)) }
+  end
+
   def handle_received(data, %{"action" => "bid", "params" => bid}, id) do
     participant = Map.get(data.participants, id)
     participant_actions = %{}

              }}
            end
          end) |> Enum.into(%{})
        else
          seller_bids = [{id, bid} | data.seller_bids]
          if is_nil(data.lowest_bid) or bid < elem(data.lowest_bid, 1) do

              }}
            end
          end) |> Enum.into(%{})
          data = set_lowest_bid(data)
        else
          buyer_bids = [{id, bid} | data.buyer_bids]
          if is_nil(data.highest_bid) or bid > elem(data.highest_bid, 1) do
