Some code cleanup on thread stats.