anchor.diff:      DocId = get_value(<<"_id">>, RepProps),
       case {mem3_util:owner(DbName, DocId), get_value(deleted, Change, false)} of
       {false, _} ->
  -        replication_complete(DocId),
  +        replication_complete(DbName, DocId),
           State;
       {true, true} ->
  -        rep_doc_deleted(DocId),
  +        rep_doc_deleted(DbName, DocId),
           State;
       {true, false} ->
           case get_value(<<"_replication_state">>, RepProps) of
  
positive.code: 
  maybe_retry_replication(#rep_state{retries_left = 0} = RepState, Error, State) ->
      #rep_state{
          rep = #rep{id = RepId, doc_id = DocId},
          max_retries = MaxRetries
      } = RepState,
      couch_replicator:cancel_replication(RepId),
      true = ets:delete(?REP_TO_STATE, RepId),
      true = ets:delete(?DOC_TO_REP, DocId),
      twig:log(error, "Error in replication `~s` (triggered by document `~s`): ~s"
          "~nReached maximum retry attempts (~p).",
          [pp_rep_id(RepId), DocId, to_binary(error_reason(Error)), MaxRetries]),
  
negative.code:         <<"triggered">> ->
              maybe_start_replication(State, DbName, DocId, JsonRepDoc);
          <<"completed">> ->
              replication_complete(DbName, DocId),
              State;
          <<"error">> ->
              case ets:lookup(?DOC_TO_REP, {DbName, DocId}) of
              [] ->
                  maybe_start_replication(State, DbName, DocId, JsonRepDoc);
              _ ->
  