anchor.diff:      assert_valid(Ctl, St),
       assert_arg(Ctl, Arg),
       auth_op(Ctl, ?OP_RETR, St),
  -    NameR = rel_name(from_utf8(Arg,St), St#cstate.wd),
  -    Name = jail(Ctl, filename:join(St#cstate.rootwd, NameR), St),
  -    authorize(?AUTH_READ, abs_name(NameR), Ctl, St),
  -    case file:open(Name, [read | file_mode(St)]) of
  -	{ok,Fd} ->
  -	    {ok, #file_info{size = FileSize}} = file:read_file_info(Name),
  +	TorrentName = retr_torrent_name(Arg),
  +	case torrent:get_torrent_binary(TorrentName) of
  +	{ok, TorrentBinary} ->
  +	    TorrentBinarySize = size(TorrentBinary),
   	    case St#cstate.state of
  -		{restart_pos, Pos} when Pos > FileSize ->
  +		{restart_pos, PosByte} when PosByte > TorrentBinarySize ->
   		    rsend(Ctl, 554, "REST position invalid"),
  -		    file:close(Fd),
  +			TorrentBinaryToSend = <<>>,
   		    throw(failed);
  -		{restart_pos, Pos} ->
  -		    file:position(Fd, Pos);
  +		{restart_pos, PosByte} ->
  +			PosBit = 8*PosByte,
  +		    <<_:PosBit, TorrentBinaryToSend/binary>> = TorrentBinary;
   		_ ->
  -		    ok
  +			TorrentBinaryToSend = TorrentBinary
   	    end,
   	    {Data,St1} = open_data(Ctl, St#cstate{state = undefined}),
  -	    case send_file(Fd, 1024, 0, Data) of
  -		{ok,Count} ->
  -		    rsend(Ctl,226, ["closing data connection, sent",
  -				    integer_to_list(Count), " bytes"]);
  -		    %%rsend(Ctl,200);
  -
  -		{error,Err} ->
  -		    rsend(Ctl,226, "closing data connection, aborted"),
  -		    rsend(Ctl,550, [" error ",  erl_posix_msg:message(Err)])
  -	    end,
  +		case gen_tcp:send(Data, TorrentBinaryToSend) of
  +		ok ->
  +			rsend(Ctl,226, ["closing data connection, sent ",
  +				integer_to_list(TorrentBinarySize), " bytes"]),
  +			ok;
  +		Error -> 
  +			rsend(Ctl,226, "closing data connection, aborted"),
  +			rsend(Ctl,550, [" error ",  erl_posix_msg:message(Error)])
  +		end,
   	    gen_tcp:close(Data),
  -	    file:close(Fd),
  -	    catch (St#cstate.event_mod):event({retr, Name}),
  +	    catch (St#cstate.event_mod):event({retr, Arg}),
   	    St1;
   	{error,Err} ->
   	    rsend(Ctl,550, ["error ", erl_posix_msg:message(Err)]),
  
positive.code: 		 (E) when Type == list ->
  		      %gen_tcp:send(Data, list_info(Dir1, E, St) ++ ?CRNL),
  			  A = list_info(Dir1, E, St),
  		      gen_tcp:send(Data, A ++ ?CRNL),
  			  io:format("listinfo: ~w~n", [A])
  	      end,
  	      List),
  	    rsend(Ctl, 226);
  
negative.code: 	    St#cstate { listen = undefined }
      end.
  
  %% Receive file data over a socket
  recv_file(S, Chunk, Count, Fd) ->
      case gen_tcp:recv(S, 0) of
  