anchor.diff:  %% @doc Check if the name is in a zone.
   -spec in_zone(binary()) -> boolean().
   in_zone(Name) ->
  -  case find_zone_in_cache(Name) of
  -    {ok, Zone} ->
  -      is_name_in_zone(Name, Zone);
  -    _ ->
  -      false
  -  end.
  +    case find_zone_in_cache(Name) of
  +        {ok, Zone} ->
  +            is_name_in_zone(Name, Zone);
  +        _ ->
  +            false
  +    end.
   
   %% @doc Return a list of tuples with each tuple as a name and the version SHA
   %% for the zone.
   -spec zone_names_and_versions() -> [{dns:dname(), binary()}].
   zone_names_and_versions() ->
  -  erldns_storage:foldl(fun(#zone{name = Name, version = Version}, NamesAndShas) ->
  -                         [{Name, Version} | NamesAndShas]
  -                       end, [], zones).
  -
  -% ----------------------------------------------------------------------------------------------------
  -% Write API
  +    erldns_storage:foldl(fun(#zone{name = Name, version = Version}, NamesAndShas) ->
  +                                 [{Name, Version} | NamesAndShas]
  +                         end, [], zones).
  +
  +%% -----------------------------------------------------------------------------------------------
  +%% Write API
   
   %% @doc Put a name and its records into the cache, along with a SHA which can be
   %% used to determine if the zone requires updating.
  
positive.code: exclude_mname_duplicates(SOA, NameServers) ->
      MName = SOA#dns_rrdata_soa.mname,
      lists:foldl(fun(NameServer, Acc0) ->
          case NameServer#dns_rrdata_ns.dname =:= MName of
              true ->
                  %% Found a NS record that is also a mname of an SOA, exclude it
                  Acc0;
              false ->
                  [NameServer | Acc0]
          end
      end, [], NameServers).
  
  %% @doc This function takes a list of nameservers, finds it's A/AAAA record in the given record set
  %% and returns the nameserver's IP address.
  
negative.code:             ok = put_zone(ZoneName, Zone),
              send_notify(ZoneName, Zone)
      end.
  
  %% -----------------------------------------------------------------------------------------------
  %% Gen server init
  
  %% @doc Initialize the zone cache.
  -spec init([]) -> {ok, #state{}}.
  init([]) ->
      case erldns_config:storage_type() of
          erldns_storage_mnesia ->
              erldns_storage:create(schema);
          _ ->
              ok
      end,
      erldns_storage:create(zones),
      erldns_storage:create(authorities),
      {ok, #state{parsers = []}}.
  
  %% -----------------------------------------------------------------------------------------------
  %% gen_server callbacks
  
  %% @doc Write the zone into the cache.
  handle_call({put, Name, Zone}, _From, State) ->
      erldns_storage:insert(zones, {normalize_name(Name), Zone}),
      {reply, ok, State};
  
  handle_call({put, Name, Sha, Records, AllowNotifyList, AllowTransferList, AllowUpdateList, AlsoNotifyList,
               NotifySourceIP}, _From, State) ->
      erldns_storage:insert(zones,
                            {normalize_name(Name), build_zone(Name, AllowNotifyList, AllowTransferList,
                                                              AllowUpdateList, AlsoNotifyList,
                                                              NotifySourceIP, Sha, Records)}),
      {reply, ok, State}.
  
  handle_cast({put, Name, Zone}, State) ->
      erldns_storage:insert(zones, {normalize_name(Name), Zone}),
      {noreply, State};
  
  handle_cast({put, Name, Sha, Records, AllowNotifyList, AllowTransferList, AllowUpdateList, AlsoNotifyList,
               NotifySourceIP}, State) ->
      erldns_storage:insert(zones,
                            {normalize_name(Name), build_zone(Name, AllowNotifyList, AllowTransferList,
                                                              AllowUpdateList, AlsoNotifyList,
                                                              NotifySourceIP, Sha, Records)}),
      {noreply, State};
  
  handle_cast({delete, Name}, State) ->
      erldns_storage:delete(zones, normalize_name(Name)),
      {noreply, State};
  
  handle_cast(Message, State) ->
      erldns_log:debug("Received unsupported message: ~p", [Message]),
      {noreply, State}.
  
  handle_info(_Message, State) ->
      {noreply, State}.
  
  terminate(_Reason, _State) ->
      ok.
  
  code_change(_PreviousVersion, State, _Extra) ->
      {ok, State}.
  
  
  %% Internal API
  %% @doc Removes the expiration timestamp from the list of dns_rrs stored in the dict.
  -spec remove_expiry([{non_neg_integer(), dns:rr()}] | []) -> [] | [dns:rr()].
  remove_expiry([]) ->
  