anchor.diff:  			   [Pfx, G1] ->
   			       {orddict:fetch(Pfx, Imports), G1}
   		       end,
  +    TypeDefs = [{typedef,L,Type,Def} || {typedef,L,Type,Def} <- Where],
  +    io:fwrite("TypeDefs = ~p~n", [TypeDefs]),
  +    Data1 = Data ++ TypeDefs,
       case [L || {grouping,_,Grp,L} <- Where,
   	       Grp == GrpName] of
   	[] ->
  -	    [{"uses-not-found", binary_to_list(G)} | rpc_params(T, Data, Imports)];
  +	    [{"uses-not-found", binary_to_list(G)} | rpc_params(T, Data1, Imports)];
   	[Params] ->
  -	    rpc_params(Params, Data, Imports) ++ rpc_params(T, Data, Imports)
  +	    rpc_params(Params, Data1, Imports) ++ rpc_params(T, Data1, Imports)
       end;
   rpc_params([{leaf,_,N,Is}|T], Data, Imports) ->
  -    [{binary_to_list(N), "", descr(Is)} | rpc_params(T, Data, Imports)];
  +    [{binary_to_list(N), "", descr(Is), type(Is,Data,Imports)}
  +     | rpc_params(T, Data, Imports)];
   rpc_params([{anyxml,_,N,Is}|T], Data, Imports) ->
  -    [{binary_to_list(N), "", descr(Is)} | rpc_params(T, Data, Imports)];
  +    [{binary_to_list(N), "", descr(Is), type(Is,Data,Imports)}
  +     | rpc_params(T, Data, Imports)];
   rpc_params([{list,_,N,Items}|T], Data, Is) ->
  -    [{binary_to_list(N), {array, [{struct, rpc_params(Items, Data, Is)}]}, descr(Items)}
  +    [{binary_to_list(N), {array, [{struct, rpc_params(Items, Data, Is)}]},
  +      descr(Items), type(Items, Data, Is)}
        | rpc_params(T, Data, Is)];
   rpc_params([_|T], Data, Is) ->
       rpc_params(T, Data, Is);
  
positive.code: 
  to_json_rpc(Data, Dir) ->
      Imports = imports(Data, Dir),
      [{binary_to_list(N), mk_rpc_pair(InOut, N, Data, Imports)} || {rpc,_,N,InOut} <- Data].
  
  imports(Data, Dir) ->
      lists:foldl(
  
negative.code:     [].
  
  markdown_descriptions(Msg) ->
      case [X || {_,{_,_}} = X <- collect_descriptions(Msg, orddict:new())] of
  	[] -> [];
  	[{K,{D,T}}|Tail] ->
  	    ["**descriptions**\n",
  	     "<dl><dt>", K, "</dt>\n", "<dd>", D, " (<b>type:</b> ", T, ")", "</dd>",
  	     [["\n<dt>", K1, "</dt>\n", "<dd>", D1, " (<b>type:</b> ", T1, ")", "</dd>"]
  	      || {K1,{D1,T1}} <- Tail],
  	     "\n</dl>\n\n"]
      end.
  
  collect_descriptions(Msg, Acc) ->
      Res = collect_descriptions_(Msg, Acc),
      io:fwrite("descriptions(~p) = ~p~n", [Msg, Res]),
      Res.
  
  collect_descriptions_({struct, L}, Acc) ->
      lists:foldl(fun collect_descriptions_/2, Acc, L);
  collect_descriptions_({array, L}, Acc) ->
      lists:foldl(fun collect_descriptions_/2, Acc, L);
  collect_descriptions_({K,V,D,T}, Acc) ->
      collect_descriptions_(V, orddict:store(K, {D,T}, Acc));
  collect_descriptions_({_K,V}, Acc) ->
      collect_descriptions_(V, Acc);
  collect_descriptions_(_, Acc) ->
      Acc.
  
  
  pp_json(Json) ->
  