Pull out calculation logic into stats module.