match logic complete