added check for winner function