added the read part of the code