Added the 'needLog' parameter to 'compare' function