anchor.diff:      {atomic, ok} = mnesia:transaction(fun () -> mnesia:write(Thread), mnesia:write(Comment) end),
       {reply, summarize(Thread), BoardName};
   handle_call({reply, ThreadId, User, Tripcode, Body, File}, _From, BoardName) -> 
  -    Rec = db:find(thread, #thread.id, ThreadId),
  +    Rec = find_thread(ThreadId),
       active = Rec#thread.status,
       Id = now(),
       TripHash = case Tripcode of
  
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).
  