Fix single-line truncation error; move persistLines to own function