Simplify chunk insertion. Last chunk always reuse existing marker. Fixed issues related to newline insertion.