Revert "Removed threading"

This reverts commit 8f695c55153216ec35ff3b3d95c3971a5ef246f4.