anchor.diff:      mnesia:create_table(thread, [{type, ordered_set}, {disc_copies, [node()]}, {attributes, record_info(fields, thread)}]),
       mnesia:create_table(comment, [{type, ordered_set}, {disc_copies, [node()]}, {attributes, record_info(fields, comment)}]).
   
  +find_thread(Id) -> db:find(thread, #thread.id, Id).
  +find_comm(Id) -> db:find(comment, #comment.id, Id).
  +
   %%%%%%%%%%%%%%%%%%%% generic actions
   start(BoardName) -> gen_server:start_link({local, BoardName}, ?MODULE, BoardName, []).
   stop(BoardName) -> gen_server:call(BoardName, stop).
  
positive.code: delete(Board, {image, CommentId}) -> 
      gen_server:call(Board, {delete_comment_image, CommentId});
  delete(Board, Id) -> 
      case db:find(thread, #thread.id, Id) of
  	false -> gen_server:call(Board, {delete_comment, Id});
  	_ -> gen_server:call(Board, {delete_thread, Id})
      end.
  
negative.code: 		   end),
      {reply, collect_files([First | Rest]), BoardName};
  handle_call({delete_comment, CommentId}, _From, BoardName) ->
      Comment = find_comm(CommentId),
      Thread = find_thread(Comment#comment.thread),
      New = deleted_comment(Comment),
      db:atomic_insert([replace_comment_cache(Thread, CommentId, summarize(New)), New]),
      {reply, Comment#comment.file, BoardName};
  handle_call({delete_comment_image, CommentId}, _From, BoardName) ->
      Comment = find_comm(CommentId),
      Thread = find_thread(Comment#comment.thread),
      OldFile = Comment#comment.file,
      New = Comment#comment{file=deleted},
      db:atomic_insert([replace_comment_cache(Thread, CommentId, summarize(New)), New]),
      {reply, OldFile, BoardName};
  
  %%%%%%%%%% non-delete write operations
  