anchor.diff:  state_to_on(State) ->
       {A, B, C, D, E, F, _G} = State,
       {A, B, C, D, E, F}.
  +
  +-spec state_subscribe(state(), comm:mypid()) -> state().
  +state_subscribe(State, Pid) ->
  +    Subs = state_get_subs(State),
  +    NewSubs = case lists:keyfind(Pid, 1, Subs) of
  +                  false -> fd:subscribe(Pid),
  +                           [{Pid, 1} | Subs];
  +                  Tuple ->
  +                      NewVal = setelement(2, Tuple, element(2, Tuple) + 1),
  +                      lists:keyreplace(Pid, 1, Subs, NewVal)
  +              end,
  +    state_set_subs(State, NewSubs).
  +
  +-spec state_unsubscribe(state(), comm:mypid()) -> state().
  +state_unsubscribe(State, Pid) ->
  +    Subs = state_get_subs(State),
  +    NewSubs = case lists:keyfind(Pid, 1, Subs) of
  +                  false -> Subs;
  +                  Tuple ->
  +                      case element(2, Tuple) of
  +                          1 ->
  +                              %% delay the actual unsubscribe for better perf.?
  +                              fd:unsubscribe(element(1, Tuple)),
  +                              lists:keydelete(Pid, 1, Subs);
  +                          Num ->
  +                              NewVal = setelement(2, Tuple, Num - 1),
  +                              lists:keyreplace(Pid, 1, Subs, NewVal)
  +                      end
  +              end,
  +    state_set_subs(State, NewSubs).
   
   %% @doc Checks whether config parameters for tx_tm_rtm exist and are
   %%      valid.
  
positive.code:             %% In the future, we will handle this using msg_delay for
              %% outstanding txids to trigger a delete of the items.
      end,
      State;
  
  %% generated by on(register_TP) via msg_delay to not increase memory
  %% footprint
  
negative.code:     %% lookup transaction id locally and merge with given TxState
      Tid = tx_state:get_tid(TxState),
      {LocalTxStatus, LocalTxEntry} = my_get_tx_entry(Tid, State),
      {TmpEntry, NewState} =
          case LocalTxStatus of
              new ->
                  TmpState = state_subscribe(State, tx_state:get_tm(TxState)),
                  {TxState, TmpState}; %% nothing known locally
              uninitialized ->
                  %% take over hold back from existing entry
                  %%io:format("initRTM takes over hold back queue for id ~p in ~p~n", [Tid, Role]),
                  HoldBackQ = tx_state:get_hold_back(LocalTxEntry),
                  {tx_state:set_hold_back(TxState, HoldBackQ), State};
              ok ->
                  log:log(error, "Duplicate init_RTM", []),
                  {LocalTxEntry, State}
          end,
      NewEntry = tx_state:set_status(TmpEntry, ok),
      _ = my_set_entry(NewEntry, NewState),
  
      %% lookup items locally and merge with given ItemStates
      NewItemStates =
          [ begin
                EntryId = tx_item_state:get_itemid(Entry),
                {LocalItemStatus, LocalItem} = my_get_item_entry(EntryId, NewState),
                TmpItem = case LocalItemStatus of
                              new -> Entry; %% nothing known locally
                              uninitialized ->
  