merged from ba/match_stuff