Consolidated code into callCompare() function.