change algo of compare method