MLB wild-card tiebreaker rules

It seems unlikely to happen this year given the current wild-card standings, but if multiple teams tie for a single wild-card spot in MLB this year, here's how the ties would be broken:​

If there are three or four teams tied for wild-card spots, the first step is to designate teams A, B, and C (three teams) or A, B, C, and D (four teams). This is done by a complicated system that first uses head-to-head records, then winning percentage in division or league games, then winning percentage in second half division/league games, and, finally, winning percentage in division/league games in the second half of the season, plus one game, then going back one game at a time until the ties have been broken.
Two Teams Tied for One Wild-Card Spot - The two teams would play one game to determine the wild card.
Three Teams Tied for One Wild-Card Spot - Team A hosts Team B for one game. The winner hosts Team C for one game, and the winner is the wild-card team.
Three Teams Tied for Two Wild-Card Spots - Team A hosts Team B for one game. The winner is declared a wild card. The loser of the game plays at Team C, and the winner is the second wild-card team.
Four Teams Tied for One Wild-Card Spot - Team A hosts Team B, and Team C hosts Team D. The two winners play the next day at the field of the winner between A and B. The winner is the wild card.
Four Teams Tied for Two Wild-Card Spots - Team A hosts Team B, and Team C hosts Team D. The two winners are the wild card teams.

​I can't wait until four teams tie for a single wild-card spot one year. That would be fantastic.