multithreaded version. Can go faster with ThreadedWriter but that one looses some data at the moment