Refactor diagnostic into statistic and