anchor.diff:  %%%%%%%%%% delete operations
   handle_call({delete_thread, ThreadId}, _From, BoardName) ->
       [First | Rest] = db:do(qlc:q([X || X <- mnesia:table(comment), X#comment.thread =:= ThreadId])),
  -    Thread = db:find(thread, #thread.id, ThreadId),
  +    Thread = find_thread(ThreadId),
       Comm = deleted_comment(First),
       New = Thread#thread{status=deleted, first_comment=summarize(Comm), last_comments=[], comment_count=1},
       db:transaction(fun() ->
  
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:     lists:reverse(Res).
  
  replace_comment_cache(Thread, CommentId, NewComment) ->
      [First | Rest] = lists:keyreplace(CommentId, 1, 
  				      [Thread#thread.first_comment | Thread#thread.last_comments], 
  				      NewComment),
      Thread#thread{first_comment=First, last_comments=Rest}.
  
  sort_threads({_, A, _, _}, {_, B, _, _}) ->
      common:now_to_seconds(A) > common:now_to_seconds(B).
  