implemented multiprocessing for pairing