Work on threading model, plus more threading checks and improvements