Got rid of the separate write thread and merged it with read.