anchor.diff:      [Item].
   
   
  --define(cancel_timer(TimerRef),
  -    case erlang:cancel_timer(TimerRef) of
  -        false ->
  -            %% No timer found and we have not seen the timeout message
  -            receive
  -                {timeout,(TimerRef),_} ->
  -                    ok
  -            end;
  -        _ ->
  -            %% Timer was running
  -            ok
  -    end).
  -
  +-define(
  +   cancel_timer(TimerRef),
  +   case erlang:cancel_timer(TimerRef) of
  +       false ->
  +           %% No timer found and we have not seen the timeout message
  +           receive
  +               {timeout,(TimerRef),_} ->
  +                   ok
  +           end;
  +       _ ->
  +           %% Timer was running
  +           ok
  +   end).
  +%%
  +%% Cancel timer and consume timeout message
  +%%
   -compile({inline, [cancel_timer/1]}).
   cancel_timer(TimerRef) ->
       ?cancel_timer(TimerRef).
   
  +-define(
  +   cancel_timer(TimeoutType, TimerRef, Timers),
  +   begin
  +       ?cancel_timer(TimerRef),
  +       maps:remove(begin TimeoutType end, begin Timers end)
  +   end).
  +%%
  +%% Cancel timer and remove from Timers
  +%%
  +-compile({inline, [cancel_timer/3]}).
  +cancel_timer(TimeoutType, TimerRef, Timers) ->
  +    ?cancel_timer(TimeoutType, TimerRef, Timers).
  +
   %% Cancel timer if running, otherwise no op
   %%
   %% Remove the timer from Timers
  --compile({inline, [cancel_timer_by_type/2]}).
  -cancel_timer_by_type(TimeoutType, {TimerRefs,TimeoutTypes} = Timers) ->
  -    case TimeoutTypes of
  +-compile({inline, [cancel_timer/2]}).
  +cancel_timer(TimeoutType, Timers) ->
  +    case Timers of
           #{TimeoutType := TimerRef} ->
  -            ?cancel_timer(TimerRef),
  -            {maps:remove(TimerRef, TimerRefs),
  -             maps:remove(TimeoutType, TimeoutTypes)};
  +            ?cancel_timer(TimeoutType, TimerRef, Timers);
           #{} ->
               Timers
       end.
   
  --compile({inline, [cancel_timer_by_ref_and_type/4]}).
  -cancel_timer_by_ref_and_type(
  -  TimerRef, TimeoutType, TimerRefs, TimeoutTypes) ->
  -    ?cancel_timer(TimerRef),
  -    {maps:remove(TimerRef, TimerRefs),
  -     maps:remove(TimeoutType, TimeoutTypes)}.
  +%% Return a list of all pending timeouts
  +list_timeouts(Timers) ->
  +    {maps:size(Timers),
  +     maps:fold(
  +       fun(TimeoutType, {_TimerRef,TimeoutMsg}, Acc) ->
  +               [{TimeoutType,TimeoutMsg}|Acc]
  +       end, [], Timers)}.
  
positive.code:   P, Debug, S,
    Events, NextState_NewData,
    NextEventsR, Hibernate, TimeoutsR, Postponed,
    {TimerRefs,TimeoutTypes} = Timers, Seen, TimeoutEvents,
    TimeoutType) ->
      %% This function body should have been:
      %%    Timers_1 = cancel_timer_by_type(TimeoutType, Timers),
      %%    loop_timeouts(
      %%      P, Debug, S,
      %%      Events, NextState_NewData,
  
negative.code:         _ ->
              %% (Re)start the timer
              TimerRef =
                  erlang:start_timer(Time, self(), TimeoutType, TimeoutOpts),
              case Debug of
                  ?not_sys_debug ->
                      loop_timeouts_register(
                        P, Debug, S, Events, NextState_NewData,
                        NextEventsR, Hibernate, TimeoutsR, Postponed,
                        Timers, Seen, TimeoutEvents,
                        TimeoutType, TimerRef, TimeoutMsg);
                  _ ->
                      {State,_Data} = NextState_NewData,
                      Debug_1 =
  