anchor.diff:  %%====================================================================
   init([]) ->
       {ok, Dir} = application:get_env(etorrent, dir),
  -    % Provide a timeout in 100 ms to get up fast
  -    {ok, #state{dir = Dir, fileset = sets:new()}, 100}.
  +    _Tid = ets:new(etorrent_dirwatcher, [named_table, protected]),
  +    {ok, #state{dir = Dir}, 0}.
   
  -handle_call(report_on_files, _Who, S) ->
  -    {reply, sets:to_list(S#state.fileset), S, ?WATCH_WAIT_TIME};
   handle_call(dir_watched, _Who, S) ->
       {reply, S#state.dir, S, ?WATCH_WAIT_TIME};
   handle_call(_Request, _From, State) ->
  
positive.code:     {noreply, S, ?WATCH_WAIT_TIME}.
  
  handle_info(timeout, S) ->
      N = watch_directories(S),
      {noreply, N, ?WATCH_WAIT_TIME};
  handle_info(_Info, State) ->
      {noreply, State, ?WATCH_WAIT_TIME}.
  
  
negative.code: 
  %% Operations
  watch_directories(S) ->
      reset_marks(ets:first(etorrent_dirwatcher)),
      F = fun(F, ok) ->
  		process_file(F),
  		ok
  	end,
      ok = filelib:fold_files(S#state.dir, ".*\.torrent", false,
  				F, ok),
      ets:safe_fixtable(etorrent_dirwatcher, true),
      start_stop(ets:first(etorrent_dirwatcher)),
      ets:safe_fixtable(etorrent_dirwatcher, false),
      ok.
  
  process_file(F) ->
      case ets:lookup(etorrent_dirwatcher, F) of
  	[] ->
  	    ets:insert(etorrent_dirwatcher, {F, new});
  	[_] ->
  	    ets:insert(etorrent_dirwatcher, {F, marked})
      end.
  
  reset_marks('$end_of_table') -> ok;
  reset_marks(Key) ->
      ets:insert(etorrent_dirwatcher, {Key, unmarked}),
      reset_marks(ets:next(etorrent_dirwatcher, Key)).
  
  start_stop('$end_of_table') -> ok;
  start_stop(Key) ->
      [{Key, S}] = ets:lookup(etorrent_dirwatcher, Key),
      case S of
  	new -> etorrent_mgr:start(Key);
  	marked -> ok;
  	unmarked -> etorrent_mgr:stop(Key),
  		    ets:delete(etorrent_dirwatcher, Key)
      end,
      start_stop(ets:next(etorrent_dirwatcher, Key)).
  