     case each_diagonal(-envelope, envelope, paths, [], keywords?) do
       {:done, edits} ->
         compact_reverse(edits, [])
-      {:next, paths} -> find_script(envelope + 1, max, paths, keywords?)
-    end
-  end
-
-  defp compact_reverse([], acc),
-    do: acc
+
+      {:next, paths} ->
+        find_script(envelope + 1, max, paths, keywords?)
+    end
+  end
+
+  defp compact_reverse([], acc), do: acc
 
   defp compact_reverse([{:diff, _} = fragment | rest], acc),
     do: compact_reverse(rest, [fragment | acc])


  defp map_difference(map1, map2) do
    {surplus, altered, same} =
      Enum.reduce(map1, {[], [], []}, fn({key, val1}, {surplus, altered, same}) ->
        case Map.fetch(map2, key) do
          {:ok, ^val1} ->
            {surplus, altered, [{key, val1} | same]}
          {:ok, val2} ->
            {surplus, [{key, {val1, val2}} | altered], same}
          :error ->
            {[{key, val1} | surplus], altered, same}
        end
      end)
    missing = Enum.reduce(map2, [], fn({key, _} = pair, acc) ->
      if Map.has_key?(map1, key), do: acc, else: [pair | acc]
    end)
    {surplus, altered, missing, same}
  end


  defp script_keyword_inner({key, val1}, {key, val2}, true),
    do: [{:eq, format_key(key, true)}, script_inner(val1, val2)]

  defp script_keyword_inner(_pair1, _pair2, true), do: nil

  defp script_keyword_inner(elem1, elem2, false), do: script(elem1, elem2)

  defp move_right({x, x, [elem1 | rest1] = list1, [elem2 | rest2], edits}, keywords?) do
    if result = script_keyword_inner(elem1, elem2, keywords?) do
