I've made small improvements to this patch: variable naming, formatting, comments.
Great, thanks!
BTW, do we really need to set shouldCount depending on whether we receive stats argument or not? What if we always set shouldCount as in the first branch of "if"?