Added functions to read from and write to the memory