anchor.diff:  set /a "perc%~1=!change%~1!*100/!STotalSize%~1!" 2>nul
   set /a "fract=!change%~1!*100%%!STotalSize%~1!*100/!STotalSize%~1!" 2>nul
   set /a "perc%~1=!perc%~1!*100+%fract%" 2>nul
  -::call:division change%~1 1024 100
   call:division perc%~1 100 100
   exit /b
   
   ::%1 - JPG|PNG|GIF
   ::%2 - Total Size
   ::%3 - Image Size
  -:calcstep
  +:stepcalc
   set /a "TotalSize%~1+=%~2"
  -set /a "ImageSize%~1+=%~2"
  -if !TotalSize%~1! lss %BYTECONV% if !ImageSize%~1! lss %BYTECONV% exit /b
  +set /a "ImageSize%~1+=%~3"
  +if !ImageSize%~1! lss %BYTECONV% if !TotalSize%~1! lss %BYTECONV% exit /b
   set /a "STotalSize%~1+=!TotalSize%~1!/!step%~1!"
   set /a "SImageSize%~1+=!ImageSize%~1!/!step%~1!"
   set "TotalSize%~1=0"
   set "ImageSize%~1=0"
  -if !STotalSize%~1! lss %BYTECONV% if !SImageSize%~1! lss %BYTECONV% exit /b
  -set /a "step%~1*=10"
  +if !SImageSize%~1! lss %BYTECONV% if !STotalSize%~1! lss %BYTECONV% exit /b
   set /a "STotalSize%~1/=10"
   set /a "SImageSize%~1/=10"
  +set /a "step%~1*=10"
   exit /b
   
   :totalmsg
  -set /a "tt=!TotalNum%~1!+!TotalNumErr%~1!"
  -if "%tt%" equ "0" exit /b
  -if "%~2" equ "0" (
  -	set "opt=0"
  -	set "tterr=%tt%"
  -	set "nopt=0"
  -) else (
  -	set "nopt=!TotalNumNOpt%~1!"
  -	set /a "opt=!TotalNum%~1!-!nopt!"
  -	set "tterr=!TotalNumErr%~1!"
  -)
  -echo. Total Number of %1:	%tt%
  -echo. Optimized %1:		%opt%
  -if "%nopt%" neq "0" echo. Not optimized %1:	%nopt%
  -if "%tterr%" neq "0" echo. Skipped %1:		%tterr%
  +set /a "tt=!TotalNum%~1!-!TotalNumNOpt%~1!"
  +if %tt% equ 0 exit /b
  +if not defined isfirst (
  +	echo.                                     Total
  +	echo.-------------------------------------------------------------------------------
  +	set "isfirst=1"
  +)
   set "stepcur=!step%~1!"
   set "stepm=1"
  +set "F1=%~1                                  "
  +set "F5=           !perc%~1!"
   for %%a in (KB KB KB MB MB MB GB GB GB TB TB TB) do (
   	set /a "stepcur/=10"
  -	set /a "stepm=stepm*10%%1000"
  -	if !stepm! equ 0 set "stepm=1"
  +	set /a "stepm=stepm*10"
  +	if !stepm! equ 1000 set "stepm=1"
   	if !stepcur! equ 1 (
  -		call:division change%~1 1 !stepm!
  -		echo. Total %1:  		!change%~1! %%a, !perc%~1!%%
  +		set /a "stepm=1000/!stepm!"
  +		call:division STotalSize%~1 !stepm! !stepm!
  +		call:division SImageSize%~1 !stepm! !stepm!
  +		call:division change%~1 !stepm! !stepm!
  +		set "F2=           !STotalSize%~1!"
  +		set "F3=           !SImageSize%~1!"
  +		set "F4=           !change%~1!"
  +		echo. !F1:~,%TFN%!^|!F2:~-9!%%~a^|!F3:~-9!%%~a^|!F4:~-8!%%~a^|%F5:~-9%%%
  +		exit /b
   ))
  -echo.
  -exit /b
  -
  -:listerrfiles
  -set "iserr="
  -for %%a in ("%filelisterr%") do if %%~za gtr 0 (
  -	set "iserr=1"
  -	echo.
  -	echo. Image with characters:
  -	type "%%~a"
  -	echo.
  -)
  -set "iserr2="
  -for /f "tokens=2* delims=:" %%a in ('findstr /e /i /r /c:";error" "%logfile%*" 2^>nul') do (
  -	if not defined iserr (set "iserr=1" & echo.)
  -	if not defined iserr2 (echo. Images with errors:& set "iserr2=1")
  -	for /f "tokens=1-2 delims=;" %%c in ("%%~b") do echo. %%~c
  -)
  -if defined iserr2 echo.
  -if defined iserr (echo.-------------------------------------------------------------------------------)
  -set "iserr=" & set "iserr2="
   exit /b
   
   :readini
  
positive.code: ::%5 - percent change (%4*100/%2)
  ::%6 - png | jpg | gif
  :printfileinfo
  if "%~4" equ "0" (
  	>>"%filelisterr1%" echo.%~f1
  	exit /b
  )
  setlocal  
  set "fn="
  call:cropfilename fn %1 %TFN%
  
negative.code: 
  :end
  call:setvtime ftime
  if %jpeg% equ 0 if %png% equ 0 if %gif% equ 0 1>nul 2>&1 ping -n 1 -w 500 127.255.255.255 & goto:finmessage
  for %%b in ("%filelisterr%2" "%filelisterr%3") do (
  	for /f "tokens=1" %%a in ('findstr /e /i /c:".png" "%%~b*" 2^>nul ^| find /i /c ".png" 2^>nul') do (
  		set /a "TotalNumErrPNG+=%%a" & set /a "TotalNumPNG-=%%a"
  	)
  	for /f "tokens=1" %%a in ('findstr /e /i /c:".jpg" "%%~b*" 2^>nul ^| find /i /c ".jpg" 2^>nul') do (
  		set /a "TotalNumErrJPG+=%%a" & set /a "TotalNumJPG-=%%a"
  	)
  	for /f "tokens=1" %%a in ('findstr /e /i /c:".jpe" "%%~b*" 2^>nul ^| find /i /c ".jpe" 2^>nul') do (
  		set /a "TotalNumErrJPG+=%%a" & set /a "TotalNumJPG-=%%a"
  	)
  	for /f "tokens=1" %%a in ('findstr /e /i /c:".jpeg" "%%~b*" 2^>nul ^| find /i /c ".jpeg" 2^>nul') do (
  		set /a "TotalNumErrJPG+=%%a" & set /a "TotalNumJPG-=%%a"
  	)
  	for /f "tokens=1" %%a in ('findstr /e /i /c:".gif" "%%~b*" 2^>nul ^| find /i /c ".gif" 2^>nul') do (
  		set /a "TotalNumErrGIF+=%%a" & set /a "TotalNumGIF-=%%a"
  	)
  )
  set /a "TotalNumNOpt=TotalNumNOptPNG+TotalNumNOptJPG+TotalNumNOptGIF"
  if %TotalNumNOpt% gtr 0 (
  	echo.                         Images are already optimized
  	echo.-------------------------------------------------------------------------------
  	type %filelisterr%1
  	echo.-------------------------------------------------------------------------------
  )
  set /a "TotalNumErr=TotalNumErrPNG+TotalNumErrJPG+TotalNumErrGIF"
  if %TotalNumErr% gtr 0 (
  	set "isfirst="
  	for %%a in ("%filelisterr%2*") do (
  		if not defined isfirst (
  			echo.                           Images are not supported
  			echo.-------------------------------------------------------------------------------
  			set "isfirst=1"
  		)
  		type "%%~a"
  	)
  	if defined isfirst echo.-------------------------------------------------------------------------------
  	set "isfirst="
  	for %%a in ("%filelisterr%3*") do (
  		if not defined isfirst (
  			echo.                             Images are not found
  			echo.-------------------------------------------------------------------------------
  			set "isfirst=1"
  		)
  		type "%%~a"
  	)
  	if defined isfirst echo.-------------------------------------------------------------------------------
  )
  for %%a in ("%filelisterr%") do if %%~za gtr 0 (
  	echo.                            Images with characters
  	echo.-------------------------------------------------------------------------------
  	type "%%~a"
  	echo.-------------------------------------------------------------------------------
  )
  set "isfirst="
  call:fincalc PNG
  call:fincalc JPG
  call:fincalc GIF
  :finmessage
  call:totalmsg PNG %png%
  call:totalmsg JPG %jpeg%
  call:totalmsg GIF %gif%
  if defined isfirst echo.-------------------------------------------------------------------------------
  echo. Outdir: %outdir%
  echo.
  echo. Started  at - %stime%
  echo. Finished at - %ftime%
  echo.-------------------------------------------------------------------------------
  echo. Image optimization is completed.
  echo.-------------------------------------------------------------------------------
  if /i "%updatecheck%" equ "true" (
  