anchor.diff:    case TypeMatches of
       [] ->
         %% Ask the custom handlers for their records.
  -      %lager:debug("No type matches found, using custom handlers"),
         NewRecords = lists:map(erldns_records:replace_name(Qname), lists:flatten(lists:map(custom_lookup(Qname, Qtype, MatchedRecords), erldns_handler:get_handlers()))),
  -      %lager:debug("Records from custom handlers: ~p", [NewRecords]),
         resolve_best_match_with_wildcard(Message, Qname, Qtype, Host, CnameChain, MatchedRecords, Zone, [], NewRecords);
       _ ->
         resolve_best_match_with_wildcard(Message, Qname, Qtype, Host, CnameChain, MatchedRecords, Zone, [], TypeMatches)
  
positive.code: 
  % Given an exact name match and the type of ANY, return all of the matched records.
  resolve_exact_match_referral(Message, ?DNS_TYPE_ANY, MatchedRecords, _ReferralRecords, _AuthorityRecords) ->
    %lager:debug("Exact match ANY"),
    Message#dns_message{aa = true, answers = MatchedRecords};
  % Given an exact name match and the type NS, where the NS records are not found in record set
  % return the NS records in the answers section of the message.
  
negative.code:   case TypeMatches of
      [] ->
        %% Ask the custom handlers for their records.
        NewRecords = lists:flatten(lists:map(custom_lookup(Qname, Qtype, MatchedRecords), erldns_handler:get_handlers())),
        resolve_exact_match(Message, Qname, Qtype, Host, CnameChain, MatchedRecords, Zone, NewRecords, AuthorityRecords);
      _ ->
        resolve_exact_match(Message, Qname, Qtype, Host, CnameChain, MatchedRecords, Zone, TypeMatches, AuthorityRecords)
    end.
  
  %% There were no matches for exact name and type, so now we are looking for NS records
  %% in the exact name matches.
  resolve_exact_match(Message, _Qname, Qtype, Host, CnameChain, MatchedRecords, Zone, _ExactTypeMatches = [], AuthorityRecords) ->
    ReferralRecords = lists:filter(erldns_records:match_type(?DNS_TYPE_NS), MatchedRecords), % Query matched records for NS type
    resolve_no_exact_type_match(Message, Qtype, Host, CnameChain, [], Zone, MatchedRecords, ReferralRecords, AuthorityRecords);
  
  %% There were exact matches of name and type.
  resolve_exact_match(Message, Qname, Qtype, Host, CnameChain, _MatchedRecords, Zone, ExactTypeMatches, AuthorityRecords) ->
    resolve_exact_type_match(Message, Qname, Qtype, Host, CnameChain, ExactTypeMatches, Zone, AuthorityRecords).
  
  
  