Factor out _goto_win, avoid shelling out