adding option to parallelise the matching function