Optimize replacing carriage returns