work-in-progress porting preserveBlankLines
finished porting changes