multithreading seems to work now! seen bug once where client connection drives the previous output when previous connection gets stuck at not waking for final write