added write and read from txt file