added multiprocessing mode to term distances