     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])

  end

  defp script_tuple({tuple1, index1}, {_, index2} = right, acc)
      when index1 > index2 do
    elem = elem(tuple1, index1)
    elem_diff = [del: ", ", del: inspect(elem)]
    script_tuple({tuple1, index1 - 1}, right, [elem_diff | acc])
  end

  defp script_tuple({_, index1} = left, {tuple2, index2}, acc)
      when index1 < index2 do
    elem = elem(tuple2, index2)
    elem_diff = [ins: ", ", ins: inspect(elem)]
    script_tuple(left, {tuple2, index2 - 1}, [elem_diff | acc])

  defp check_if_proper_and_get_length([_ | rest], length),
    do: check_if_proper_and_get_length(rest, length + 1)

  defp check_if_proper_and_get_length([], length), do: {true, length}

  defp check_if_proper_and_get_length(_other, length), do: {false, length + 1}

  # The algorithm is outlined in the
  # "String Matching with Metric Trees Using an Approximate Distance"
