added method read and write