caveats: if the last character isn't a newline, add one