made compare function