                               profile: profile,
                               ifname: profile.ifname}
 
-    # Clean up any old configuration on the interface
-    deconfigure(state)
-
+    # Check the status and set an initial event through based
+    # on whether the interface is up or down
     status = NetBasic.status(net_basic, profile.ifname)
-
-    # TODO: if status is up, then send ifup notification
-    Logger.info "Initial #{state.ifname} status is: #{inspect status}"
     handle_info({:net_basic, net_basic, :ifchanged, status}, state)
 
     {:ok, state}

  def handle_info({:net_basic, _, :ifchanged, %{:is_lower_up => true}}, state) do
    Logger.info "#{state.ifname} just came up"
    configure(state)
  end
  def handle_info({:net_basic, _, :ifchanged, %{:is_lower_up => false}}, state) do
    Logger.info "#{state.ifname} just went down"
    deconfigure(state)
  end

  defp configure(state) do
    :ok = NetBasic.set_config(state.net_basic, state.profile.static_ip)
    :ok = Resolvconf.configure(state.resolvconf, state.profile.static_dns)
  end

  defp deconfigure(state) do
    :ok = Resolvconf.clear(state.resolvconf, state.profile.ifname)
  end

end

    end

    def handle_event({:net_basic, _, :ifchanged, %{:ifname => ifname}}=event, %EventHandler{ifname: ifname}=state) do
      send state.manager, event
      {:ok, state}
    end
    def handle_event(event, state) do
      Logger.error "Ignoring unmatching event: #{inspect event}"
      {:ok, state}
    end
  end
