Added a function to check for winner