Changed the data type of read to a reference to get the read value