Refactored outputStatistics() for improved maintainability and extensibility