                 Mapname := RegExReplace(Mapname, ".+[\/\\]", "")
             }
             SplitPath, A_LoopFileName,,,, FileNameNoExt
-            If RenamingMaskNumber = 1
-            {
-                filelist :=
-                (Join
-                filelist . A_LoopFileName
-                . "`t" . FileNameNoExt . "_" . Mapname . "." . A_LoopFileExt . "`n"
-                )
-            }
-            else if RenamingMaskNumber = 2
-            {
-                filelist :=
-                (Join
-                filelist . A_LoopFileName
-                . "`t" . Mapname . "_" . FileNameNoExt . "." . A_LoopFileExt . "`n"
-                )
-            }
-            else if RenamingMaskNumber = 3
-            {
-                FormatTime, mod_date, %A_LoopFileTimeModified%, yyyy
-                filelist :=
-                (Join
-                filelist . A_LoopFileName
-                . "`t" . mod_date . "_" . Mapname . "_" . FileNameNoExt . "." . A_LoopFileExt . "`n"
-                )
-            }
-            else if RenamingMaskNumber = 4
-            {
-                FormatTime, mod_date, %A_LoopFileTimeModified%, yyyy
-                filelist :=
-                (Join
-                filelist . A_LoopFileName
-                . "`t" . mod_date . "_" . FileNameNoExt . "_" . Mapname . "." . A_LoopFileExt . "`n"
-                )
-            }
-            else if RenamingMaskNumber = 5
-            {
-                FormatTime, mod_date, %A_LoopFileTimeModified%, yyyy-MM
-                filelist :=
-                (Join
-                filelist . A_LoopFileName
-                . "`t" . mod_date . "_" . Mapname . "_" . FileNameNoExt . "." . A_LoopFileExt . "`n"
-                )
-            }
-            else if RenamingMaskNumber = 6
-            {
-                FormatTime, mod_date, %A_LoopFileTimeModified%, yyyy-MM
-                filelist :=
-                (Join
-                filelist . A_LoopFileName
-                . "`t" . mod_date . "_" . FileNameNoExt . "_" . Mapname . "." . A_LoopFileExt . "`n"
-                )
-            }
-            else if RenamingMaskNumber = 7
-            {
-                FormatTime, mod_date, %A_LoopFileTimeModified%, yyyy-MM-dd
-                filelist :=
-                (Join
-                filelist . A_LoopFileName
-                . "`t" . mod_date . "_" . Mapname . "_" . FileNameNoExt . "." . A_LoopFileExt . "`n"
-                )
-            }
-            else
-            {
-                FormatTime, mod_date, %A_LoopFileTimeModified%, yyyy-MM-dd
-                filelist :=
-                (Join
-                filelist . A_LoopFileName
-                . "`t" . mod_date . "_" . FileNameNoExt . "_" . Mapname . "." . A_LoopFileExt . "`n"
-                )
-            }
+            new_file_name := RenamingOption(RenamingMaskNumber, Mapname, FileNameNoExt)
+            filelist := filelist . new_file_name
         }
         else
         {

                {
                    needle := RegExReplace(needle, ".+[\/\\]", "")
                }
                arraypos := HasVal(Mapname, needle)
                If !arraypos
                {

                    Mapname.Push(needle)
                }
            }
        }

        If Mapname.MaxIndex()
        {
            Mapnames_all := ""
            while A_Index <= Mapname.MaxIndex()
            {
                If Mapnames_all
                {
                    Mapnames_all := Mapnames_all . "+"
                }
                Mapnames_all := Mapnames_all . Mapname[A_Index]
            }
            SplitPath, A_LoopFileName,,,, FileNameNoExt
            If RenamingMaskNumber = 1
            {
                filelist :=
                (Join
                filelist . A_LoopFileName
                . "`t" . FileNameNoExt . "_" . Mapnames_all . "." . A_LoopFileExt . "`n"
                )
            }
            else if RenamingMaskNumber = 2
            {
                filelist :=
                (Join
                filelist . A_LoopFileName
                . "`t" . Mapnames_all . "_" . FileNameNoExt . "." . A_LoopFileExt . "`n"
                )
            }
            else if RenamingMaskNumber = 3
            {
                FormatTime, mod_date, %A_LoopFileTimeModified%, yyyy
                filelist :=
                (Join
                filelist . A_LoopFileName
                . "`t" . mod_date . "_" . Mapnames_all . "_" . FileNameNoExt . "." . A_LoopFileExt . "`n"
                )
            }
            else if RenamingMaskNumber = 4
            {
                FormatTime, mod_date, %A_LoopFileTimeModified%, yyyy
                filelist :=
                (Join
                filelist . A_LoopFileName
                . "`t" . mod_date . "_" . FileNameNoExt . "_" . Mapnames_all . "." . A_LoopFileExt . "`n"
                )
            }
            else if RenamingMaskNumber = 5
            {
                FormatTime, mod_date, %A_LoopFileTimeModified%, yyyy-MM
                filelist :=
                (Join
                filelist . A_LoopFileName
                . "`t" . mod_date . "_" . Mapnames_all . "_" . FileNameNoExt . "." . A_LoopFileExt . "`n"
                )
            }
            else if RenamingMaskNumber = 6
            {
                FormatTime, mod_date, %A_LoopFileTimeModified%, yyyy-MM
                filelist :=
                (Join
                filelist . A_LoopFileName
                . "`t" . mod_date . "_" . FileNameNoExt . "_" . Mapnames_all . "." . A_LoopFileExt . "`n"
                )
            }
            else if RenamingMaskNumber = 7
            {
                FormatTime, mod_date, %A_LoopFileTimeModified%, yyyy-MM-dd
                filelist :=
                (Join
                filelist . A_LoopFileName
                . "`t" . mod_date . "_" . Mapnames_all . "_" . FileNameNoExt . "." . A_LoopFileExt . "`n"
                )
            }
            else
            {
                FormatTime, mod_date, %A_LoopFileTimeModified%, yyyy-MM-dd
                filelist :=
                (Join
                filelist . A_LoopFileName
                . "`t" . mod_date . "_" . FileNameNoExt . "_" . Mapnames_all . "." . A_LoopFileExt . "`n"
                )
            }
        }
        else
        {

    return 0
}

RenamingOption(RenamingMaskNumber, Mapname, FileNameNoExt)
{
    If RenamingMaskNumber = 1
    {
        new_file_name :=
        (Join
        A_LoopFileName
        . "`t" . FileNameNoExt . "_" . Mapname . "." . A_LoopFileExt . "`n"
        )
    }
    else if RenamingMaskNumber = 2
    {
        new_file_name :=
        (Join
        A_LoopFileName
        . "`t" . Mapname . "_" . FileNameNoExt . "." . A_LoopFileExt . "`n"
        )
    }
    else if RenamingMaskNumber = 3
    {
        FormatTime, mod_date, %A_LoopFileTimeModified%, yyyy
        new_file_name :=
        (Join
        A_LoopFileName
        . "`t" . mod_date . "_" . Mapname . "_" . FileNameNoExt . "." . A_LoopFileExt . "`n"
        )
    }
    else if RenamingMaskNumber = 4
    {
        FormatTime, mod_date, %A_LoopFileTimeModified%, yyyy
        new_file_name :=
        (Join
        A_LoopFileName
        . "`t" . mod_date . "_" . FileNameNoExt . "_" . Mapname . "." . A_LoopFileExt . "`n"
        )
    }
    else if RenamingMaskNumber = 5
    {
        FormatTime, mod_date, %A_LoopFileTimeModified%, yyyy-MM
        new_file_name :=
        (Join
        A_LoopFileName
        . "`t" . mod_date . "_" . Mapname . "_" . FileNameNoExt . "." . A_LoopFileExt . "`n"
        )
    }
    else if RenamingMaskNumber = 6
    {
        FormatTime, mod_date, %A_LoopFileTimeModified%, yyyy-MM
        new_file_name :=
        (Join
        A_LoopFileName
        . "`t" . mod_date . "_" . FileNameNoExt . "_" . Mapname . "." . A_LoopFileExt . "`n"
        )
    }
    else if RenamingMaskNumber = 7
    {
        FormatTime, mod_date, %A_LoopFileTimeModified%, yyyy-MM-dd
        new_file_name :=
        (Join
        A_LoopFileName
        . "`t" . mod_date . "_" . Mapname . "_" . FileNameNoExt . "." . A_LoopFileExt . "`n"
        )
    }
    else
    {
        FormatTime, mod_date, %A_LoopFileTimeModified%, yyyy-MM-dd
        new_file_name :=
        (Join
        A_LoopFileName
        . "`t" . mod_date . "_" . FileNameNoExt . "_" . Mapname . "." . A_LoopFileExt . "`n"
        )
    }
    return new_file_name
}

ParsingDemofiles(RenamingMaskNumber, counter_files_quotient)
{
    Loop, Files, *.dem
