Clean up text_formatter code with a byte.Buffer

This has performance benefits since we're no longer converting from string to []byte (which copies the entire string as well as allocates more memory for the []byte), but also just looks much tidier.