improve thread counting