Threads now working on linux. Not tested thoroughly