updated pairwiseCombine and removeMin