Sped up pairs_to_results.py