Make reason for failure more obvious.
Extract string breaking function a bit
Optimize removal of extra newlines