Use arrays of bytes rather than replacing in strings