anchor.diff:  
   % There is no referral, so check to see if there is a wildcard.
   resolve_best_match(Message, Qname, Qtype, Host, CnameChain, BestMatchRecords, Zone) ->
  -  %lager:debug("No referrals found"),
     resolve_best_match(Message, Qname, Qtype, Host, CnameChain, BestMatchRecords, Zone, lists:any(erldns_records:match_wildcard(), BestMatchRecords)).
   
   %% It's a wildcard match
   resolve_best_match(Message, Qname, Qtype, Host, CnameChain, BestMatchRecords, Zone, true) ->
  -  %lager:debug("Matched records are wildcard."),
     CnameRecords = lists:filter(erldns_records:match_type(?DNS_TYPE_CNAME), lists:map(erldns_records:replace_name(Qname), BestMatchRecords)),
     resolve_best_match_with_wildcard(Message, Qname, Qtype, Host, CnameChain, BestMatchRecords, Zone, CnameRecords);
   %% It is not a wildcard.
   resolve_best_match(Message, Qname, _Qtype, _Host, _CnameChain, _BestMatchRecords, Zone, false) ->
  -  %lager:debug("Matched records are not wildcard."),
     [Question|_] = Message#dns_message.questions,
     case Qname =:= Question#dns_query.name of
       true ->
  
positive.code: 
  % Indicates CNAME loop
  resolve_best_match_with_wildcard_cname(Message, _Qname, _Qtype, _Host, _CnameChain, _BestMatchRecords, _Zone, _CnameRecords, true) ->
    %lager:debug("CNAME loop detected (best match)"),
    Message#dns_message{aa = true, rc = ?DNS_RCODE_SERVFAIL};
  
  % We should follow the CNAME
  resolve_best_match_with_wildcard_cname(Message, _Qname, Qtype, Host, CnameChain, _BestMatchRecords, Zone, CnameRecords, false) ->
    %lager:debug("Follow CNAME (best match)"),
    CnameRecord = lists:last(CnameRecords),
    Name = CnameRecord#dns_rr.data#dns_rrdata_cname.dname,
    restart_query(Message#dns_message{aa = true, answers = Message#dns_message.answers ++ CnameRecords}, Name, Qtype, Host, CnameChain ++ CnameRecords, Zone, erldns_zone_cache:in_zone(Name)).
  
negative.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) ->
    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.
  