Fixed missing 'var' that was causing the 'win' variable to be global in the first place