redesigned reader, added writer, reader and writer are started from main thread