   end
 
   def map(chunked_texts) do
-    Enum.map(chunked_texts, fn chunked_texts ->
+    chunked_texts
+    |> Enum.map(fn chunked ->
       pid = spawn_link(Worker, :loop, [])
-      send pid, {:calc, self, chunked_texts}
+      send pid, {:calc, self, chunked}
       pid
     end)
   end
 
-  def reduce(pids) do
+  def await(pids) do
     pids
     |> Enum.flat_map(fn pid ->
       receive do
         {:freq, ^pid, freq} -> freq
       end
     end)
+  end
+
+  def reduce(results) do
+    results
     |> Enum.reduce(%{}, fn {k, c}, m ->
       Map.merge(m, %{k => c}, fn _k, o, n -> o + n end)
     end)

  """
  @spec frequency([String.t], pos_integer) :: map
  def frequency(texts, workers) do
    chunk_by_worker(texts, workers)
    |> map
    |> reduce
  end

  def chunk_by_worker(texts, workers) do
    jobs = length(texts)
    cnt = div(jobs, workers)


      texts
      |> Enum.flat_map(&String.graphemes/1)
      |> Enum.map(&String.downcase/1)
      |> Enum.filter(fn ch -> Regex.match?(~r/\p{L}/, ch) end)
      |> Enum.group_by(&( &1 ))
      |> Enum.map(fn {k, ls} -> {k, length(ls)} end)
      |> Enum.into(%{})
