added logic to figure out who won the match