Stop using string concatenation to avoid large memory allocations