refactor matchmaking