finished the multi threaded impl. some more testing and checking needed.