Adds thread management