Refactor statistic a big and introduce a horrible-but-necessary macro