anchor.diff:              {delete_chart, Id} ->
                   wf:wire("deleteChart(\"" ++ integer_to_list(Id) ++ "\");"),
                   gui_utils:flush(),
  -                ?MODULE:comet_loop(Counter, PageState#page_state{charts = dict:erase(Id, Charts)})
  +                ?MODULE:comet_loop(Counter, PageState#page_state{charts = proplists:delete(Id, Charts)})
   
           end
       catch Type:Msg ->
  
positive.code:     gui_utils:flush().
  
  
  %% validate/1
  %% ====================================================================
  %% @doc Checks whether user has selected all requiered options to plot chart
  -spec validate(PageState :: #page_state{}) -> ok | error.
  %% ====================================================================
  validate(#page_state{node = undefined}) ->
      error_message(<<"Please select host.">>),
      error;
  validate(#page_state{time_range = undefined}) ->
      error_message(<<"Please select time range.">>),
      error;
  validate(#page_state{chart_type = undefined}) ->
      error_message(<<"Please select chart type.">>),
      error;
  validate(_) ->
      ok.
  
  
  %% host_dropdown_body/0
  
negative.code:             add_chart ->
                  gui_utils:remove("error_message"),
                  gui_utils:flush(),
                  case validate_page_state(PageState) of
                      ok ->
                          case validate_chart(Node, TimeRange, ChartType, Charts) of
                              ok ->
                                  case create_chart(Counter, Node, TimeRange, ChartType) of
                                      {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]});
                                      _ ->
                                          error_message(<<"There has been an error in chart creation. Please try again.">>)
                                  end;
                              _ -> error_message(<<"Chart already added.">>)
                          end;
                      _ -> ok
                  end,
                  ?MODULE:comet_loop(Counter, PageState);
  
              {update_chart, Id} ->
                  try
                      case proplists:get_value(Id, Charts) of
                          undefined ->
                              ?error("Can not update chart ~p: chart does not exist.", [Id]);
                          Chart ->
                              ok = update_chart(Chart),
                              erlang:send_after(1000 * Chart#chart.update_period, self(), {update_chart, Id})
                      end
                  catch
                      _:Error -> ?error("Can not update chart ~p: ~p", [Id, Error])
                  end,
  