anchor.diff:  	    nomatch
       end.
   
  -get_forwards_for_users([]) ->
  -    [];
  -get_forwards_for_users([User | Rest]) ->
  -    lists:append(get_forward_for_user(User), get_forwards_for_users(Rest)).
  +get_forwards_for_users(In) ->
  +    get_forwards_for_users2(In, []).
  +
  +get_forwards_for_users2([], Res) ->
  +    lists:usort(Res);
  +get_forwards_for_users2([H | T], Res) ->
  +    case get_forward_for_user(H) of
  +	error ->
  +	    error;
  +	nomatch ->
  +	    get_forwards_for_users2(T, Res);
  +	Fwd ->
  +	    get_forwards_for_users2(T, lists:append(Res, [Fwd]))
  +    end.
   
   get_forward_for_user(User) ->
       case database_forward:fetch(User) of
   	{atomic, []} ->
   	    logger:log(debug, "userdb-mnesia: No forwards found for user ~p", [User]),
  -	    [];
  +	    nomatch;
   	{atomic, [F]} ->
   	    F;
   	Unknown ->
   	    logger:log(error, "userdb-mnesia: Unexpected result from database_forward:fetch(), user ~p result : ~p",
   		       [User, Unknown]),
  -	    []
  -    end.
  +	    error
  +    end.
  
positive.code: 		{atomic, Numbers} ->
  		    logger:log(debug, "userdb-mnesia: Found number(s) ~p for user ~p",
  			       [Numbers, User]),
  		    lists:append([local:canonify_user(User)], local:canonify_numberlist(Numbers));
  		Unknown ->
  		    logger:log(error, "userdb-mnesia: Unexpected result from phone:get_numbers_for_user(), user ~p result : ~p",
  			       [User, Unknown]),
  
negative.code: 		   Unknown1 ->
  		       logger:log(error, "userdb-mnesia: Unexpected result from phone:get_user(), address ~p result : ~p",
  				  [Address, Unknown1]),
  		       error
  	       end,
      case UserList of
  	error ->
  	    error;
  	_ ->
  	    case phone:get_users_for_number(Address) of
  		{atomic, []} ->
  		    UserList;
  		{atomic, NumberUsers} ->
  		    lists:usort(UserList, lists:sort(NumberUsers));
  		Unknown2 ->
  		    logger:log(error, "userdb-mnesia: Unexpected result from phone:get_users_for_number(), address ~p result : ~p",
  			       [Address, Unknown2]),
  		    UserList
  	    end
      end.
  
  get_users_for_addresses_of_record(In) ->
      get_users_for_addresses_of_record2(In, []).
  
  get_users_for_addresses_of_record2([], Res) ->
      lists:usort(Res);
  get_users_for_addresses_of_record2([H | T], Res) ->
      case get_users_for_address_of_record(H) of
  	Users when list(Users) ->
  	    get_users_for_addresses_of_record2(T, lists:append(Res, Users));
  	_ ->
  	    get_users_for_addresses_of_record2(T, Res)
      end.
  
  
  %% Function: get_addresses_for_users/1
  %% Description: Iterate over a list of users, return all their 
  %%              addresses without duplicates. Uses the next function,
  %%              get_addresses_for_user/1.
  %% Returns: ListOfAddresses
  %%--------------------------------------------------------------------
  get_addresses_for_users([]) ->
      [];
  get_addresses_for_users([User | Rest]) ->
      lists:append(get_addresses_for_user(User), get_addresses_for_users(Rest)).
  
  
  %% Gets all addresses for a user. Used for example
  %% to check if a request from a user has an acceptable
  