Use append instead of bytes.Buffer for better performance