Extract a printResults() function