Rearranged win condition code, fixes #3