updated detection of winner, but algorithm still fails