first version of MatchEndPopup (still buggy)