   end
 
   # Wait for messages from child processes
-  defp wait_for_messages(entries, original, output, options, waiting, queued, schedulers, result) do
+  defp wait_for_messages(state) do
+    %{entries: entries, options: options, waiting: waiting, queued: queued, result: result} = state
+
     receive do
       {:struct_available, module} ->
         available = for {:struct, pid, _, waiting_module, _defining} <- waiting,
                         module == waiting_module,
                         do: {pid, :found}
 
-        spawn_compilers(available ++ entries, original, output, options,
-                        waiting, queued, schedulers, [{:struct, module} | result])
+        spawn_compilers(%{state | entries: available ++ entries, result: [{:struct, module} | result]})
 
       {:module_available, child, ref, file, module, binary} ->
         if callback = Keyword.get(options, :each_module) do

    :elixir_code_server.cast({:reset_warnings, compiler_pid})
    schedulers = max(:erlang.system_info(:schedulers_online), 2)

    result = spawn_compilers(files, files, path, options, [], [], schedulers, [])

    # In case --warning-as-errors is enabled and there was a warning,
    # compilation status will be set to error.


        cancel_waiting_timer(queued, child)

        spawn_compilers(%{state | entries: available ++ entries, result: [{:module, module} | result]})

      {:waiting, kind, child, ref, on, defining} ->
        defined = fn {k, m} -> on == m and k in [kind, :module] end
