comparsion func finished