Refactor matchmaking