 
   defp keys(%Xema.Map{keys: nil}, _value), do: :ok
   defp keys(%Xema.Map{keys: :atom}, map) do
-    if map |> Map.keys |> Enum.all?(&is_atom/1),
-      do: :ok,
-      else: {:error, %{reason: :invalid_keys, keys: :atom}}
+    case map |> Map.keys |> Enum.all?(&is_atom/1) do
+      true -> :ok
+      false -> error :invalid_keys, keys: :atom
+    end
   end
   defp keys(%Xema.Map{keys: :string}, map) do
-    if map |> Map.keys |> Enum.all?(&is_binary/1),
-      do: :ok,
-      else: {:error, %{reason: :invalid_keys, keys: :string}}
+    case map |> Map.keys |> Enum.all?(&is_binary/1) do
+      true -> :ok
+      false -> error :invalid_keys, keys: :string
+    end
   end
 
   defp properties(%Xema.Map{properties: nil}, map), do: {:ok, map}

      {:error, %{reason: :missing_dependency, for: key, dependency: dependency}}
    end
  end
end

  defp do_property(schema, value) do
    case Xema.validate(schema, value) do
      :ok -> :ok
      {:error, reason} -> error :invalid_property, error: reason
    end
  end

  defp get_value(map, key) when is_atom(key) do
    do_get_value(map, to_string(key), key)
  end
  defp get_value(map, key) do
    do_get_value(map, key, String.to_atom(key))
  end
  defp do_get_value(map, key_string, key_atom) do
    case {Map.get(map, key_string), Map.get(map, key_atom)} do
      {nil, nil} -> nil
      {nil, value} -> value
      {value, nil} -> value
      _ ->
        error :mixed_map
    end
  end

