use StringBuilder for consistent line endings