anchor.diff:                                      {ok, Chart} ->
                                           reset_dropdowns(Nodes),
                                           erlang:send_after(1000 * Chart#chart.update_period, self(), {update_chart, Counter}),
  -                                        ?MODULE:comet_loop(Counter + 1, PageState#page_state{node = undefined, time_range = undefined, chart_type = undefined, charts = [{Counter, Chart} | Charts]});
  +                                        PageState#page_state{counter = Counter + 1, node = undefined, time_range = undefined, chart_type = undefined, charts = [{Counter, Chart} | Charts]};
                                       _ ->
  -                                        error_message(<<"There has been an error during chart creation. Please try again.">>)
  +                                        error_message(<<"There has been an error during chart creation. Please try again.">>),
  +                                        PageState
                                   end;
  -                            _ -> error_message(<<"Chart already added.">>)
  +                            _ -> error_message(<<"Chart already added.">>),
  +                                PageState
                           end;
  -                    _ -> ok
  -                end,
  -                ?MODULE:comet_loop(Counter, PageState);
  +                    _ -> PageState
  +                end;
   
               {update_chart, Id} ->
                   try
  
positive.code: -include("logging.hrl").
  
  % n2o API and comet
  -export([main/0, event/1, comet_loop/2]).
  
  -define(TIME_RANGES, [<<"last 5 minutes">>, <<"last 15 minutes">>, <<"last hour">>, <<"last 24 hours">>, <<"last 7 days">>, <<"last 30 days">>, <<"last 365 days">>]).
  -define(SUMMARY_CHART_TYPES, [<<"CPU utilization">>, <<"memory usage">>, <<"network throughput">>, <<"network transfer">>, <<"Erlang ports transfer">>, <<"storage IO transfer">>]).
  -define(HOST_CHART_TYPES, [<<"CPU utilization">>, <<"memory usage">>, <<"network throughput">>, <<"network transfer">>, <<"Erlang ports transfer">>]).
  -define(GEN_SERVER_TIMEOUT, 5000).
  
  -record(page_state, {nodes, node, time_range, chart_type, charts = []}).
  -record(chart, {id, node, time_range, type, update_period}).
  
  %% main/0
  
negative.code:                 catch
                      _:Error -> ?error("Can not update chart ~p: ~p", [Id, Error])
                  end,
                  PageState;
  
              {delete_chart, Id} ->
                  gui_jq:wire(<<"deleteChart(\"", (integer_to_binary(Id))/binary, "\");">>),
                  gui_comet:flush(),
                  PageState#page_state{charts = proplists:delete(Id, Charts)}
  
          end
                     catch Type:Msg ->
                         ?debug_stacktrace("~p ~p", [Type, Msg]),
                         error_message(<<"There has been an error in comet process. Please refresh the page.">>),
                         {error, Msg}
                     end,
      ?MODULE:comet_loop(NewPageState).
  
  
  %% error_message/1
  