   end
 
   def status(conn, %{"id" => id}) do
-    case Sites.is_valid_id?(id) do
-      {:error, _} -> handle_status(nil, id, conn)
-      {:ok, _} -> Sites.get_site(id) |> handle_status(id, conn)
-    end
-  end
-
-  defp handle_status(nil, _id, conn) do
-    redirect(conn, to: Routes.page_path(conn, :index, conn.assigns.locale))
+    id
+    |> Sites.get_site()
+    |> handle_status(id, conn)
+  end
+
+  defp handle_status(%Sites.Site{status: "done"} = site, _id, conn) do
+    redirect(conn,
+      to: Routes.site_path(conn, :results, conn.assigns.locale, url: site.input_url)
+    )
   end
 
   defp handle_status(site, id, conn) do
     case site.status do
-      "queue" ->
+      x when x in ["queue", "processing"] ->
         render(conn, "status.html", id: id, site: site, page_title: gettext("Status"))
 
-      "processing" ->
-        render(conn, "status.html", id: id, site: site, page_title: gettext("Status"))
-
-      "failed" ->
-        redirect(conn,
-          to: Routes.site_path(conn, :results, conn.assigns.locale, url: site.input_url)
-        )
-
-      "done" ->
+      x when x in ["failed", "done"] ->
         redirect(conn,
           to: Routes.site_path(conn, :results, conn.assigns.locale, url: site.input_url)
         )

  plug(:check_if_site_exists when action in [:check])
  plug(:check_rate_ip when action in [:check])
  plug(:check_rate_url_host when action in [:check])

  def check(%Plug.Conn{assigns: %{input_url: proper_url}} = conn, _params) do
    {:ok, id} = Sites.add_site(proper_url)


  defp handle_results({id, site}, conn, _url) do
    case site.status do
      x when x in ["queue", "processing"] ->
        redirect(conn,
          to: Routes.site_path(conn, :status, conn.assigns.locale, id: id, site: site)
        )
