anchor.diff:  
   init([]) ->
       {ok, #state{target_resource_types = [],
  -                local_resources       = dict:new(),
  -                resources             = dict:new()}}.
  +                local_typed_resources = dict:new(),
  +                typed_resources       = dict:new()}}.
   
   handle_call({fetch_resources, Type}, _From, State) ->
  -    {reply, dict:find(Type, State#state.resources), State};
  -handle_call(_Request, _From, State) ->
  -    Reply = ok,
  -    {reply, Reply, State}.
  +    {reply, dict:find(Type, State#state.typed_resources), State}.
   
   handle_cast({add_target_resource_type, Type}, State) ->
       TargetTypes = State#state.target_resource_types,
       NewTargetTypes = [Type | lists:delete(Type, TargetTypes)],
       {noreply, State#state{target_resource_types = NewTargetTypes}};
  -handle_cast({add_local_resource, {Type, Instance}}, State) ->
  -    LocalResources = State#state.local_resources,
  -    NewLocalResources = add_resource(Type, Instance, LocalResources),
  -    {noreply, State#state{local_resources = NewLocalResources}};
  +handle_cast({add_local_resource, {Type, Resource}}, State) ->
  +    LocalTypedResources = State#state.local_typed_resources,
  +    NewLocalTypedResources = add_resource(Type, Resource, LocalTypedResources),
  +    {noreply, State#state{local_typed_resources = NewLocalTypedResources}};
   handle_cast(trade_resources, State) ->
  -    LocalResources = State#state.local_resources,
  +    LocalTypedResources = State#state.local_typed_resources,
       AllNodes = [node() | nodes()],
       lists:foreach(
           fun(Node) ->
               gen_server:cast({?SERVER, Node},
  -                            {trade_resources, {node(), LocalResources}})
  +                            {trade_resources, {node(), LocalTypedResources}})
           end,
           AllNodes),
       {noreply, State};
  -handle_cast({trade_resources, {ReplyTo, RemoteResources}},
  -            #state{local_resources       = LocalResources,
  -                   target_resource_types = TargetTypes,
  -                   resources             = Resources} = State) ->
  -    ResourceList = resources_for_types(TargetTypes, RemoteResources),
  -    NewResources = add_resources(ResourceList, Resources),
  +handle_cast({trade_resources, {ReplyTo, RemoteTypedResources}},
  +           #state{local_typed_resources = LocalTypedResources,
  +		  target_resource_types = TargetTypes,
  +		  typed_resources       = TypedResources} = State) ->
  +    FilteredRemoteTypedResources = filter_remote_resources_by_target_types(TargetTypes, RemoteTypedResources),
  +    NewTypedResources = add_typed_resources(FilteredRemoteTypedResources, TypedResources),
       case ReplyTo of
           noreply ->
               ok;
           _ ->
               gen_server:cast({?SERVER, ReplyTo},
  -                            {trade_resources, {noreply, LocalResources}})
  +                            {trade_resources, {noreply, LocalTypedResources}})
       end,
  -    {noreply, State#state{resources = NewResources}};
  -handle_cast(_Msg, State) ->
  -    {noreply, State}.
  +    {noreply, State#state{typed_resources = NewTypedResources}}.
   
  -handle_info(_Info, State) ->
  +handle_info(ok = _Info, State) ->
       {noreply, State}.
   
   terminate(_Reason, _State) ->
  
positive.code: 
  %% Utilities
  
  add_resources([{Type, Identifier}|T], Dict) ->
      add_resources(T, add_resource(Type, Identifier, Dict));
  add_resources([], Dict) ->
      Dict.
  
  add_resource(Type, Resource, Dict) ->
  
negative.code:             dict:store(Type, [Resource], Dict)
      end.
  
  filter_remote_resources_by_target_types(Types, Resources) ->
      Fun =
          fun(Type, Acc) ->
              case dict:find(Type, Resources) of
                  {ok, List} ->
                      [{Type, Resource} || Resource <- List] ++ Acc;
                  error ->
                      Acc
              end
  