Added win check logic