anchor.diff:                      % We are going to consolidate the table
                       Server = self(),
                       spawn(fun() ->
  -                        % Current minute is up, consolidate the dets tables.
  -                        Tables = lists:map(fun(Filename) ->
  -                            {ok, D} = dets:open_file(Filename),
  -                            D
  -                        end, gb_trees:values(CurMinAcc)),
  -                        % Merge the dets tables
  -                        Dict = merge_dets(Tables, dict:new()),
  -                        % Convert it to ets table
  -                        Ets = ets:new(consolidated, []),
  -                        ets:insert(Ets, dict:to_list(Dict)),
  -
  -                        % Clean up
  -                        lists:foreach(fun(Table) ->
  -                            dets:close(Table)
  -                        end, Tables),
  -
  -                        % Store the consolidated table as dets
  -                        {ok, DFilename} = store_ets(Dir, OldMinute, Ets),
  -
  -                        % Delete the ets table 
  -                        ets:delete(Ets),
  -
  -                        % Tell the server we have finished consolidating
  -                        consolidated(Server, OldMinute, DFilename, gb_trees:keys(CurMinAcc))
  +                        consolidate_tables(Server, CurMinAcc)
                       end),
                       consolidating
               end
  
positive.code: time_diff_to_seconds({Days, {Hours, Minutes, Seconds}}) ->
      Days * 24 * 3600 + Hours * 3600 + Minutes * 60 + Seconds.
  
  % Loops through a set of DETS tables, looking for a key
  search_key(Key, Tables) ->
      search_key(Key, gb_trees:next(gb_trees:iterator(Tables)), []).
  search_key(_Key, none, Acc) ->
      % Merge the dicts together into a gb_trees
      lists:foldl(fun(Dict1, Tree) ->
          % Insert each item into the tree
  
negative.code: 
      % Make a note of when to expire
      case Hist of
          infinity -> ok;
          Hist -> erlang:send_after(Hist*60000, self(), {expire, Timestamp})
      end,
  
      % Build the tree for deleting
  