Refactored statistics into separate class
Implemented correct sorting for tables