       {:mark_piece_index_done, index})
   end
 
-
-  def parse_peers_binary(binary) do
-    parse_peers_binary(binary, [])
-  end
-
-  def parse_peers_binary(<<a, b, c, d, fp, sp, rest::bytes>>, acc) do
-    port = fp * 256 + sp
-    parse_peers_binary(rest, [{{a, b, c, d}, port} | acc])
-  end
-
-  def parse_peers_binary(_, acc) do
-    acc
-  end
-
-  def get_peer_list(id) do
-    {_, tab} = BittorrentClient.Torrent.Worker.get_peers(id)
-    parse_peers_binary(tab)
-  end
-
+  def add_new_piece_index(id, index) do
+    Logger.debug fn -> "#{id} is attempting to add new piece index: #{index}" end
+    GenServer.call(:global.whereis_name({:btc_torrentworker, id}),
+      {:add_piece_index, index})
+  end
+
+  def add_multi_pieces(id, lst) do
+    Logger.debug fn -> "#{id} is attempting to add multliple pieces" end
+    GenServer.call(:global.whereis_name({:btc_torrentworker, id}),
+      {:add_piece_index, lst})
+  end
   #-------------------------------------------------------------------------------
   # Utility Functions
   #-------------------------------------------------------------------------------

    end
  end

  def handle_cast({:connect_to_tracker_async}, {metadata, data}) do
    {_, _, {new_metadata, new_data}} = connect_to_tracker_helper({metadata, data})
    {:noreply, {new_metadata, new_data}}

      }
    end
  end

  def parse_peers_binary(binary) do
    parse_peers_binary(binary, [])
  end

  def parse_peers_binary(<<a, b, c, d, fp, sp, rest::bytes>>, acc) do
    port = fp * 256 + sp
    parse_peers_binary(rest, [{{a, b, c, d}, port} | acc])
  end

  def parse_peers_binary(_, acc) do
    acc
  end

  def get_peer_list(id) do
    {_, tab} = BittorrentClient.Torrent.Worker.get_peers(id)
    parse_peers_binary(tab)
  end
end
