Updated compare and seg_match