Fixing bug on "ia" response for conflicts.
Using more heredocs for output and writing files.
Code formatting tweaks. No functional changes.