anchor.diff:  encode_args([], Acc) ->
       lists:reverse(Acc);
   encode_args([H | []], Acc) ->
  -    encode_args([], [js_mochijson2:encode(H) | Acc]);
  +    encode_args([], [js_mochijson2:encode(encode(H)) | Acc]);
   encode_args([H | T], Acc) ->
  -    encode_args(T, [[js_mochijson2:encode(H), ","] | Acc]).
  +    encode_args(T, [[js_mochijson2:encode(encode(H)), ","] | Acc]).
  +
  +-spec encode(term()) -> term().
  +encode({K, V}) ->
  +    {struct, [{encode(K), encode(V)}]};
  +encode([{_K, _V} | _T] = KVList) ->
  +    %% {struct, [{encode(K), encode(V)} || {K, V} <- KVList]};
  +    %% [{struct, [{key, encode(K)}, {value, encode(V)}]} || {K, V} <- KVList];
  +    Fun = fun({K, V}, AccIn) ->
  +                  EnK = encode(K), EnV = encode(V),
  +                  case lists:keyfind(EnK, 1, AccIn) of
  +                      false ->
  +                          [{EnK, [EnV]} | AccIn];
  +                      {EnK, VL} ->
  +                          lists:keyreplace(EnK, 1, AccIn, {EnK, [EnV | VL]})
  +                  end
  +          end,
  +    Data = lists:foldl(Fun, [], KVList),
  +    {struct, Data};
  +encode(String) when is_list(String) ->
  +    list_to_binary(String);
  +encode(X) -> X.
  +
  +-spec decode(term()) -> term().
  +decode({struct, [{K, V}]}) ->
  +    {decode(K), decode(V)};
  +decode({struct, [{_K, _V} | _T] = KVList}) ->
  +    [{decode(K), decode(V)} || {K, V} <- KVList];
  +decode([{struct, _KV} | _T] = List) ->
  +    [{decode(K), decode(V)} || {struct, [{K, V}]} <- List];
  +decode(BinString) when is_binary(BinString) ->
  +    binary_to_list(BinString);
  +decode(X) -> X.
   
   %% send results back to wpool
   -spec return(pid_groups:groupname(), any()) -> ok.
  
positive.code:     return(DHTNodeGroup, lists:flatten([apply_erl(Fun, X) || X <- Data]));
  work(DHTNodeGroup, {_Round, reduce, {erlanon, FunBin}, Data}) ->
      Fun = binary_to_term(FunBin, [safe]),
      return(DHTNodeGroup, apply_erl(Fun, Data));
  
  work(DHTNodeGroup, {_Round, map, {jsanon, FunBin}, Data}) ->
      %% ?TRACE("worker: should apply ~p to ~p~n", [FunBin, Data]),
  
negative.code: 
  -define(TRACE(X, Y), ok).
  %% -define(TRACE(X, Y), io:format(X, Y)).
  
  -behaviour(gen_component).
  
  