develop compare function