Updated to use the utility functions for reading and writing the byte
array