       %{x: x, y: y, z: z} = Farmbot.BotState.get_current_pos()
       meta = %{x: x, y: y, z: z, name: Path.rootname(path)}
       pid = spawn __MODULE__, :upload, [path, meta]
+      Process.monitor(pid)
       {:noreply, %{state | uploads: Map.put(state.uploads, pid, {path, meta, 0})}}
     else
       # Logger.warn 3, "Not uploading: match: #{matches?} already_uploading?: #{already_uploading?}"

    File.mkdir_p! @images_path
    :fs_app.start(:normal, [])
    :fs.subscribe()
    Process.flag(:trap_exit, true)
    {:ok, %{uploads: %{}}}
  end

  def handle_info({_pid, {:fs, :file_event}, {path, _}}, state) do

    end
  end

  def handle_info({:DOWN, _, :process, pid, :normal}, state) do
    case state.uploads[pid] do
      nil -> {:noreply, state}
      {path, _meta, _} ->
        Logger.success 1, "Image Watcher successfully uploaded: #{path}"
        File.rm path
        {:noreply, %{state | uploads: Map.delete(state.uploads, pid)}}
    end
  end

  def handle_info({:DOWN, _, :process, pid, reason}, state) do
    case state.uploads[pid] do
      nil                   -> {:noreply, state}
      {path, _meta, 3 = ret} ->
        Logger.error 1, "Failed to upload #{path} #{ret} times. Giving up."
        File.rm path
        {:noreply, %{state | uploads: Map.delete(state.uploads, pid)}}
      {path, meta, retries}  ->
        if File.exists?(path) do
          Logger.warn 2, "Failed to upload #{path} #{inspect reason}. Going to retry."
          Process.sleep(1000 * retries)
          new_pid = spawn __MODULE__, :upload, [path, meta]
          new_uploads = state.uploads
            |> Map.delete(pid)
            |> Map.put(new_pid, {path, meta, retries + 1})
          Process.monitor(new_pid)
          {:noreply, %{state | uploads: new_uploads}}
        else
          {:noreply, %{state | uploads: Map.delete(state.uploads, pid)}}
        end
    end
  end

  def handle_info(_info, state), do: {:noreply, state}

  # Stolen from
  # https://github.com/phoenixframework/
