anchor.diff:  %% @private
   code_change(_OldVsn, State, _Extra) ->
       State.
  -
  -log(Key,Value) ->
  -    io:format("~p: ~p~n",[Key,Value]).+    
  +calc_min(Time, 0) ->
  +    Time;
  +calc_min(Time, Min) ->
  +    case Min > Time of
  +        true -> Time;
  +        _ -> Min
  +    end.
  +    
  +calc_max(Time, 0) ->
  +    Time;
  +calc_max(Time, Max) ->
  +    case Max < Time of
  +        true -> Time;
  +        _ -> Max
  +    end.
positive.code: stats(Pid) ->
      gen_server:call(Pid, stats).
  
  %%--------------------------------------------------------------------------
  %% gen_server callbacks
  %%--------------------------------------------------------------------------
  
  %% @private
  init([Connection, ProxyEx, RpcExchange, Fun]) ->
      {ok, Channel} = amqp_connection:open_channel(Connection),
      
      %%setup reply queue to get messages from RPC Server.
      #'queue.declare_ok'{queue = ReplyQ} 
          = amqp_channel:call(Channel, #'queue.declare'{}),
      log("queue.declare", "ok"),
      amqp_channel:subscribe(Channel, #'basic.consume'{queue = ReplyQ}, self()),
      log("basic.consume", "ok"),
      
      %%setup proxy exchange
      ExDeclare = #'exchange.declare'{exchange=ProxyEx, durable = true},
  
negative.code: %% @doc This module implements the Smart Proxy pattern as explained here:
  %% http://www.eaipatterns.com/SmartProxy.html
  -module(amqp_smart_proxy).
  
  -behaviour(gen_server).
  