Refactored StatCalculator classes

fixes #304