write the match making, add tests