rewritten team & match functionality