refactor the statistics