win and lose refactor