added win and lose condition