anchor.diff:          true ->
               erlang:demonitor(Ref, [flush]),
               Waiting = queue:filter(
  -                fun({_, _, V}) when V =:= Ref -> false;
  +                fun(#waiting{ref=V}) when V =:= Ref -> false;
                      (_) -> true
                   end, S#state.waiting),
               S#state{waiting=Waiting, monitors=gb_sets:delete(Ref, M)};
  
positive.code:                 Msg ->
                      erlang:demonitor(Ref, [flush]),
                      Monitors = gb_sets:delete(Ref, S#state.monitors),
                      gen_server:reply(From, Msg),
                      S#state{waiting=NewWaiting, monitors=Monitors}
              end;
          {empty, Waiting} ->
              S
      end.
  
  get_timeout(S=#state{}) ->
      case queue:is_empty(S#state.waiting) of
  
negative.code: 
  maybe_push_message(S=#state{props=Props, waiting=Waiting}) ->
      case queue:out(Waiting) of
          {{value, W=#waiting{ref=Ref}}, NewWaiting} ->
              Timeout = proplists:get_value(timeout, Props),
              case wait_valid(W) andalso
                      lmq_lib:dequeue(S#state.name, Timeout) of
                  false -> %% client timeout
                      maybe_push_message(S#state{waiting=NewWaiting});
  