 
   def find(html, selector) when is_binary(html) do
     html_tree = parse(html)
-    descendant_selector = String.split(selector)
-
-    Enum.reduce descendant_selector, html_tree, fn(selector, tree) ->
-      find(tree, selector)
-    end
-  end
-
-  def find(html_tree, "." <> class) do
-    {:ok, nodes} = find_by_selector(class, html_tree, &class_matcher/3, {:ok, []})
-
-    Enum.reverse(nodes)
-  end
-
-  def find(html_tree, "#" <> id) do
-    {_status, nodes} = find_by_selector(id, html_tree, &id_matcher/3, {:ok, []})
-
-    List.first(nodes)
-  end
-
-  def find(html_tree, tag_name) do
-    {:ok, nodes} = find_by_selector(tag_name, html_tree, &tag_matcher/3, {:ok, []})
-
-    Enum.reverse(nodes)
-  end
-
+
+    find(html_tree, selector)
+  end
+
+  def find(html_tree, selector) do
+    cond do
+      String.contains?(selector, "\s") ->
+        descendent_selector = String.split(selector)
+
+        Enum.reduce descendent_selector, html_tree, fn(selector, tree) ->
+          find(tree, selector)
+        end
+      String.starts_with?(selector, ".") ->
+        "." <> class = selector
+        {:ok, nodes} = find_by_selector(class, html_tree, &class_matcher/3, {:ok, []})
+
+        Enum.reverse(nodes)
+      String.starts_with?(selector, "#") ->
+        "#" <> id = selector
+        {_status, nodes} = find_by_selector(id, html_tree, &id_matcher/3, {:ok, []})
+
+        List.first(nodes)
+      true ->
+        {:ok, nodes} = find_by_selector(selector, html_tree, &tag_matcher/3, {:ok, []})
+
+        Enum.reverse(nodes)
+    end
+  end
 
   @doc """
   Returns a list with attribute values for a given selector.

    end
  end


  defp attribute_match?(attributes, attribute_name) do
    Enum.find attributes, fn({attr_name, _}) ->
      attr_name == attribute_name

    Enum.reverse values
  end

  defp class_matcher(class_name, node, acc) do
    {_, attributes, _} = node
    {:ok, acc_nodes} = acc
