hopefully corrected iWin code