anchor.diff:                  _OldInstance ->
                       lists:keyreplace(Key, 2, Plugins, Plugin)
               end,
  -            ok = write_plugin_config(ConfigFile, NewPlugins),
  -            init_from_config_file(State);
  +            update_plugins(NewPlugins, State);
           {error, _} = E ->
               E
       end.
  
positive.code: init_from_config_file(#state{config_file=ConfigFile} = State) ->
      case file:consult(ConfigFile) of
          {ok, [{plugins, Plugins}]} ->
              case check_plugins(Plugins, []) of
                  {ok, CheckedPlugins} ->
                      ok = init_plugins_cli(CheckedPlugins),
                      ok = start_plugins(CheckedPlugins),
                      ok = compile_hooks(CheckedPlugins),
                      {ok, handle_deferred_calls(State#state{ready=true})};
                  {error, Reason} ->
                      {error, Reason}
              end;
          {ok, _} ->
              {error, incorrect_plugin_config};
          {error, enoent} ->
              ok = write_plugin_config(ConfigFile, []),
              {ok, handle_deferred_calls(State#state{ready=true})};
          {error, Reason} ->
              {error, Reason}
  
negative.code:                     {error, plugin_not_found};
                  _ ->
                      NewPlugins = lists:keydelete(PluginKey, 2, Plugins),
                      update_plugins(NewPlugins, State)
              end;
          {error, _} = E ->
              E
      end.
  
  update_plugins(Plugins, #state{config_file=ConfigFile} = State) ->
      case load_plugins(Plugins, State) of
          {error, Reason} ->
              {error, Reason};
          {ok, NewState} ->
              ok = write_plugin_config(ConfigFile, Plugins),
              {ok, NewState}
      end.
  
  write_plugin_config(ConfigFile, NewPlugins) ->
  