anchor.diff:        {ok, true} -> true;
         _ -> false
      end,
  -   {ok, #state{document_root = DocRoot, node = node(), utc_log = UtcLog}}.
  +   Nodes = get_rbx_nodes(),
  +   {ok, #state{document_root = DocRoot, nodes = Nodes, utc_log = UtcLog}}.
   
  -handle_call(get_types, _, State) ->
  -   {reply, rbx:get_types(State#state.node), State};
  -handle_call({get_reports, Filters}, _From, State) ->
  -   Records = rbx:list(State#state.node, Filters),
  -   {reply, {Records, State#state.utc_log}, State};
  -handle_call({get_sel_reports, RecList}, _From, State) ->
  -   Records = rbx:show(State#state.node, RecList),
  +handle_call({get_types, Node}, _, State) ->
  +   {reply, rbx:get_types(Node), State};
  +handle_call({get_list, Node, DoRescan, MaxReports, Filters}, _From, State) ->
  +   if DoRescan -> rbx:rescan(Node, MaxReports);
  +   true -> ok
  +   end,
  +   RepList = rbx:list(Node, Filters),
  +   {reply, {RepList, State#state.utc_log}, State};
  +handle_call({get_sel_reports, Node, RecList}, _From, State) ->
  +   Records = rbx:show(Node, RecList),
      FmtRecords = lists:foldr(fun(R, Acc) -> [report_formatter_html:format(R, State#state.utc_log) | Acc] end, [], Records),
      {reply, FmtRecords, State};
   handle_call(get_doc_root, _From, State) ->
      {reply, State#state.document_root, State};
  -handle_call({attach, Node}, _From, State) ->
  -   case net_adm:ping(Node) of
  -      pong ->
  -         Res = rpc:call(Node, erlang, whereis, [rbx]),
  -         if
  -            is_pid(Res) ->
  -               io:format("Attached to node ~p~n", [Node]),
  -               {reply, ok, State#state{node = Node}};
  -            true ->
  -               io:format("rbx not started on ~p~n", [Node]),
  -               {reply, error, State}
  -         end;
  -      pang ->
  -         io:format("Handshake with ~p failed.~n", [Node]),
  -         {reply, error, State}
  -   end;
  -handle_call(attached_node, _From, State) ->
  -   {reply, State#state.node, State};
   handle_call(_, _, State) ->
      {reply, ok, State}.
   
  -handle_cast({rescan, MaxRecords}, State) ->
  -   rbx:rescan(State#state.node, MaxRecords),
  -   {noreply, State};
  -handle_cast(detach, State) ->
  -   {noreply, State#state{node = node()}};
   handle_cast(_Msg, State) ->
      {noreply, State}.
   
  
positive.code: %  private
  %=======================================================================================================================
  
  get_doc_root() ->
     gen_server:call(rbx_inets, get_doc_root).
  
  rescan(Query) when is_list(Query) ->
     {ok, Tokens, _} = erl_scan:string(Query),
     {ok, Term} = erl_parse:parse_term(Tokens),
     rescan(Term);
  rescan({MaxRecords, RecOnPage, Filters}) ->
     gen_server:cast(rbx_inets, {rescan, MaxRecords}),
     get_reports({Filters, 1, RecOnPage}).
  
  get_reports(Query) when is_list(Query) ->
     {ok, Tokens, _} = erl_scan:string(Query),
     {ok, Term} = erl_parse:parse_term(Tokens),
     get_reports(Term);
  get_reports({Filters, Page, RecOnPage}) ->
     AllTypes = gen_server:call(rbx_inets, get_types),
     {Records, UtcLog} = gen_server:call(rbx_inets, {get_reports, Filters}),
     lists:concat(["{\"types\":", list_to_json(AllTypes, UtcLog, fun(T, _) -> "\"" ++ atom_to_list(T) ++ "\"" end), ',',
                    "\"reports_count\":", length(Records), ',',
                   "\"reports\":", get_reports(Records, UtcLog, Page, RecOnPage), '}']).
  get_reports(Records, UtcLog, Page, RecOnPage) ->
     StartFrom = lists:nthtail((Page - 1) * RecOnPage, Records),
     PageRecords = lists:sublist(StartFrom, min(length(StartFrom), RecOnPage)),
     list_to_json(PageRecords, UtcLog, fun report_to_json/2).
  
  get_sel_reports(Query) when is_list(Query) ->
     {ok, Tokens, _} = erl_scan:string(Query),
  
negative.code: 
  -export([do/1]).
  
  -record(state, {document_root, nodes, utc_log = false}).
  
  %=======================================================================================================================
  % gen_server interface functions
  