Fixed threading issues. Damn that was hard.