improvement in thread management