add inactive thread counter
add several tests please read redme for description