   """
   @spec pretty(String.t) :: String.t
   def pretty(str) do
-    c = number(str)
-    "(#{String.slice(c, 0, 3)}) #{String.slice(c, 3, 3)}-#{String.slice(c,6,4)}"
+    "(#{area_code(str)}) #{prefix(str)}-#{line(str)}"
   end
 end

  @spec number(String.t) :: String.t
  def number(raw) do
    raw
    |> numeric
    |> String.graphemes
    |> do_number
    |> to_string
  end

  defp numeric(input), do: String.replace(input, ~r/[^0-9]*/, "")

  defp do_number(input) when length(input) == 10, do: input
  defp do_number(["1"|input]) when length(input) == 10, do: input
  defp do_number(_), do: @bad_result

  @doc """
  Get the area code of a phone number.

  """
  @spec area_code(String.t) :: String.t
  def area_code(str) do
    str
    |> to_parts
    |> List.first
  end

  @spec prefix(String.t) :: String.t
  def prefix(str) do
    str
    |> to_parts
    |> Enum.at(1)
  end

  @spec line(String.t) :: String.t
  def line(str) do
    str
    |> to_parts
    |> List.last
  end

  @doc """
