Added sender and receiver threads, modified the read() and write()
methods