anchor.diff:  current_serials(_Now, _Serials) -> {0, 0}. %% this should never happen
   
   an(#dns_query{name = NameM, type = Type} = Query,
  -   #ctx{zonename = ZoneName, followed_names = FollowedNames, rr = RRs} = Ctx,
  -   An) ->
  +   #ctx{zonename = ZoneName, rr = RRs} = Ctx) ->
       Name = dns:dname_to_lower(NameM),
       SOA = lists:keyfind(?DNS_TYPE_SOA, #dnsxd_rr.type, RRs),
       case Name of
   	ZoneName ->
  -	    NewRRs = [ RR#dnsxd_rr{name = NameM}
  -		       || #dnsxd_rr{} = RR <- RRs,
  -			  match_name(ZoneName, RR),
  -			  match_qtype(Ctx, Type, RR) ],
  -	    NewAn = An ++ NewRRs,
  -	    case NewAn of
  +	    An = [ RR#dnsxd_rr{name = NameM}
  +		   || #dnsxd_rr{} = RR <- RRs,
  +		      match_name(ZoneName, RR),
  +		      match_qtype(Ctx, Type, RR) ],
  +	    case An of
   		[] ->
   		    %% no data
   		    FinalAn = sign(Ctx, add_nsec3(false, Ctx, Query, [SOA])),
   		    {noerror, [], FinalAn, []};
  -		_ -> ad(Ctx, NewAn, [])
  +		_ -> ad(Ctx, An, [])
   	    end;
   	_ ->
   	    NameSize = byte_size(Name),
  
positive.code:     end;
  match_down(_, _, _) -> nomatch.
  
  match_cname(#ctx{}, [#dnsxd_rr{type = cname,
  			       data = #dns_rrdata_cname{dname = Next}}] = RR) ->
      {true, RR, Next};
  match_cname(#ctx{}, _) -> false.
  
  build_names(ZoneName, RRs) -> build_names(ZoneName, [ZoneName], RRs).
  
  build_names(_ZoneName, Names, []) -> lists:usort(Names);
  
negative.code: %% API
  -export([answer/3, answer/4]).
  
  -record(ctx, {now, rr, zonename, names, cuts, soa, dnssec, dnssec_keys, nsec3,
  	      cur_serial, next_serial}).
  
  %%%===================================================================
  %%% API
  