introduced thread structure instead of multiprocessing/pipe