 
   defp register_handler(em, module, args \\ []) do
     ref = make_ref()
-    case GenEvent.add_handler(em, {module, ref}, args) do
+    case GenEvent.add_mon_handler(em, {module, ref}, args) do
       :ok   -> {:ok, ref}
       error -> error
     end

    end
  end

  def handle_call({:remove_handler, module, ref}, _, %{em: em} = state) do
    {:reply, unregister_handler(em, module, ref), state}
  end

  def handle_info({:retry_connect, node}, state) do

    {:noreply, new_state}
  end

  def handle_info({:nodedown, node}, %{em: em} = state) do
    Logger.warn "Unexpected disconnect from node: #{node}"
    NodeConnector.Handler.notify_disconnect(em, node)

    case Directory.has_node?(node) do
      true ->
        new_state = attempt_connect(node, state)
