anchor.diff:           handle_call/3,
            handle_info/2,
            handle_cast/2,
  -         handle_continue/2]).
  +         handle_continue/2,
  +         format_status/2]).
   
   -define(DEFAULT_MSG_TIMEOUT, 60000).%% one minute
   
  
positive.code: handle_continue(maybe_run_fn, State) ->
      NewState = maybe_run_fn(State),
      {noreply, NewState, timeout(NewState)}.
  %%------------------------------------------------------------------------------
  %% internal functions
  %%------------------------------------------------------------------------------
  
negative.code: 
  merge_state(#state{interval = I, delay_between_executions = D, n = N, max_n = MaxN},
              #state{n = OldN, max_n = OldMaxN} = OldState) ->
      maybe_stop_timer(OldState),
      NewN = N - (OldMaxN - OldN),
      NewState = OldState#state{interval = I, delay_between_executions = D, n = NewN, max_n = MaxN, tref = undefined},
      maybe_start_timer(NewState).
  
  maybe_start_timer(#state{delay_between_executions = 0, tref = undefined} = State) ->
      State#state{can_run_fn = true};
  maybe_start_timer(#state{delay_between_executions = D, tref = undefined} = State) ->
      {ok, TRef} = timer:send_interval(D, delay_between_executions),
      State#state{can_run_fn = false, tref = TRef}.
  
  maybe_stop_timer(#state{tref = undefined}) ->
      ok;
  maybe_stop_timer(#state{tref = TRef}) ->
      {ok, cancel} = timer:cancel(TRef).
  
  maybe_run_fn(#state{schedule = [], schedule_reversed = []} = State) ->
      State;
  