add working functional compare function