Finishing the script to generate matches