anchor.diff:  normalize2(In) when is_list(In) ->	In.
   
   %%--------------------------------------------------------------------
  -%% @spec    (Names) -> [string()]
  -%%
  -%%            Names = [string()]                                                                    |
  -%%                    atom() "the name of a header in a sip message, or our internal variant of it"
  -%%
  -%% @doc     convert header key, to a standard format - lowercase and
  -%%          verbose string()
  -%% @end
  -%%--------------------------------------------------------------------
  -normalize_list(Names) ->
  -    lists:map(fun(Key) ->
  -		      normalize(Key)
  -	      end, Names).
  -
  -%%--------------------------------------------------------------------
  -%% @spec    (Name, Func, List) -> #keylist{}
  -%%
  -%%            Name = string() "the name of a header in a sip message"
  -%%            Func = fun()
  -%%            List = #keylist{}
  -%%
  -%% @doc     apply Func to all elements E; E#keyelem{item =
  -%%          F(E#keyelem.item)} - in List, where E#keyelem.key ==
  -%%          normalize(Key) A new #keyelem{key=normalize(Key),
  -%%          name=Name, item=Func([])} is added if Key isn't found
  -%% @end
  -%%--------------------------------------------------------------------
  -mod(Name, Func, List) when is_atom(Name); is_list(Name), is_record(List, keylist) ->
  +%% @spec    (Names) -> [Normalized]
  +%%          Normalized = string() | atom()
  +%%
  +%% @doc     Convert header names to an internal representation. Known
  +%%          headers are represented with atoms, unknown ones are kept
  +%%          as strings.
  +%% @end
  +%%--------------------------------------------------------------------
  +normalize_list(Names) when is_list(Names) ->
  +    [normalize(Name) || Name <- Names].
  +
  +%%--------------------------------------------------------------------
  +%% @spec    (Name, Func, Keylist) -> #keylist{}
  +%%
  +%%            Name    = string() | atom()
  +%%            Func    = fun()
  +%%            Keylist = #keylist{}
  +%%
  +%% @doc     Apply Func to all _values_ of the elements in Keylist,
  +%%          who matches Name. If no elements match Name, Func([])
  +%%          will be invoked, and the result will be added as a new
  +%%          element.
  +%% @end
  +%%--------------------------------------------------------------------
  +mod(Name, Func, #keylist{list = List}) when is_function(Func, 1), (is_atom(Name) orelse is_list(Name)) ->
       Key = normalize(Name),
  -    #keylist{list=modcase(Key, Name, Func, List#keylist.list)}.
  +    #keylist{list = modcase(Key, Name, Func, List)}.
   
   modcase(Key, Name, Func, []) ->
       %% No more input - add a new element
  -    [#keyelem{key=Key,
  -	      name=Name,
  -	      item=Func([])}];
  -modcase(Key, _Name, Func, [#keyelem{key=Key}=Elem | List]) ->
  +    [#keyelem{key  = Key,
  +	      name = Name,
  +	      value = Func([])
  +	     }
  +    ];
  +modcase(Key, _Name, Func, [#keyelem{key = Key, value = Value} = Elem | List]) ->
       %% Match, process item using Func
  -    [Elem#keyelem{item=Func(Elem#keyelem.item)} | List];
  +    [Elem#keyelem{value = Func(Value)} | List];
   modcase(Key, Name, Func, [Elem | List]) when is_record(Elem, keyelem) ->
       %% No match
       [Elem | modcase(Key, Name, Func, List)].
  
positive.code: 
      autotest:mark(?LINE, "appendlist/2 - 2"),
      %% check result
      #keylist{list=[
  		   #keyelem{key=via, name="ViA", item=["one", "two"]}
  		  ]} = AppendLH1,
  
      autotest:mark(?LINE, "appendlist/2 - 3"),
      %% {Name, Key, Value} tuples
  
negative.code: normalize("s") -> normalize2("subject");
  normalize("k") -> normalize2("supported");
  normalize("t") -> normalize2("to");
  normalize("v") -> normalize2("via");
  normalize("o") -> normalize2("event");			%% RFC3265
  normalize("u") -> normalize2("allow-events");		%% RFC3265
  normalize("r") -> normalize2("refer-to");		%% RFC3515 #7
  normalize(Name) when is_list(Name) ->
      LC = http_util:to_lower(Name),
      normalize2(LC);
  normalize(Key) when is_atom(Key) ->
      %% XXX perhaps check that it is one of the atoms we actually use?
  