 
   defp preserve_comments(line, _column, tokens, comment, rest) do
     comments = Process.get(:code_formatter_comments)
-    comment = {line, {previous_eol(tokens), next_eol(rest, 0)}, format_comment(comment, [])}
+
+    comment = %{
+      line: line,
+      previous_eol: previous_eol(tokens),
+      next_eol: next_eol(rest, 0),
+      text: format_comment(comment, [])
+    }
+
     Process.put(:code_formatter_comments, [comment | comments])
   end
 

    []
  end

  defp gather_followup_comments(line, _, [{line, {previous_eol, next_eol}, text} | comments], doc)
       when previous_eol != nil do
    gather_followup_comments(line + 1, next_eol, comments, line(doc, text))
  end

  end

  # If there is a no new line before, we can't gather all followup comments.
  defp gather_comments([%{previous_eol: nil} = comment | comments]) do
    comment = %{comment | previous_eol: @newlines}
    [comment | gather_comments(comments)]
  end

  defp gather_comments([%{line: line, next_eol: next_eol, text: doc} = comment | comments]) do
    {next_eol, comments, doc} = gather_followup_comments(line + 1, next_eol, comments, doc)
    comment = %{comment | next_eol: next_eol, text: doc}
    [comment | gather_comments(comments)]
  end

