Stats calculation now works (but not tested)