anchor.diff:              end
           end, RemoteMap, Groups).
   
  -all_local_pids(Monitors) ->
  +all_local_pids(Local) ->
       maps:to_list(maps:fold(
           fun(Pid, {_Ref, Groups}, Acc) ->
               lists:foldl(
                   fun(Group, Acc1) ->
                       Acc1#{Group => [Pid | maps:get(Group, Acc1, [])]}
  -                end,
  -                Acc,
  -                Groups
  -            )
  -        end,
  -        #{},
  -        Monitors
  -    )).
  +                end, Acc, Groups)
  +        end, #{}, Local)).
   
   %% Works as gen_server:abcast(), but accepts a list of processes
   %%   instead of nodes list.
  
positive.code:     {nodedown, node()} | {nodeup, node()}, State :: state()) -> {noreply, state()}.
  
  %% remote pid or several pids joining the group
  handle_info({join, Peer, Group, PidOrPids}, #state{scope = Scope, nodes = Nodes} = State) ->
      case maps:get(Peer, Nodes, []) of
          {MRef, RemoteGroups} ->
              join_remote(Scope, Group, PidOrPids),
              %% store remote group => pids map for fast sync operation
              NewRemoteGroups = join_remote_map(Group, PidOrPids, RemoteGroups),
              {noreply, State#state{nodes = Nodes#{Peer => {MRef, NewRemoteGroups}}}};
          [] ->
              %% handle possible race condition, when remote node is flickering up/down,
              %%  and remote join can happen after the node left overlay network
  
negative.code:             ets:insert(Scope, {Group, Pids, []})
      end.
  
  join_remote(Group, Pid, RemoteGroups) when is_pid(Pid) ->
      maps:update_with(Group, fun (List) -> [Pid | List] end, [Pid], RemoteGroups);
  join_remote(Group, Pids, RemoteGroups) ->
      maps:update_with(Group, fun (List) -> Pids ++ List end, Pids, RemoteGroups).
  
  leave_local(Pid, Group, Local) when is_pid(Pid) ->
      case maps:find(Pid, Local) of
          {ok, {MRef, [Group]}} ->
              erlang:demonitor(MRef),
              maps:remove(Pid, Local);
          {ok, {MRef, Groups}} ->
              case lists:member(Group, Groups) of
                  true ->
                      maps:put(Pid, {MRef, lists:delete(Group, Groups)}, Local);
                  false ->
                      Local
              end;
          _ ->
              Local
      end;
  leave_local([], _Group, Local) ->
      Local;
  leave_local([Pid | Tail], Group, Local) ->
      leave_local(Tail, Group, leave_local(Pid, Group, Local)).
  
  leave_local_update_ets(Scope, Group, Pid) when is_pid(Pid) ->
      case ets:lookup(Scope, Group) of
          [{Group, [Pid], [Pid]}] ->
              ets:delete(Scope, Group);
  