Refactoring - statistics calculation and output moved to separate classes