 
                 if nMatching is 1
                     flagMatching = _.keys(currentMatchingFlags)[0]
-                    return invalidFlag ext if flagMatching[i..] isnt ext[i...flagMatching.length]
-                    ext = ext[flagMatching.length..]
+                    return invalidFlag flagName if flagMatching[i..] isnt flagName[i...flagMatching.length]
+                    flagName = flagName[flagMatching.length..]
                     resetInfo()
                     flagString.pushBack(COMPILER_FLAGS[flagMatching])
                 else if nMatching is 0
                     if longestMatchingFlag?
                         flagString.pushBack(COMPILER_FLAGS[longestMatchingFlag])
-                        ext = ext[longestMatchingFlag.length..]
+                        flagName = flagName[longestMatchingFlag.length..]
                         resetInfo()
                     else
-                        return invalidFlag ext
+                        return invalidFlag flagName
 
-            if ext.length > 0
+            if flagName.length > 0
                 if longestMatchingFlag?
                     flagString.pushBack(COMPILER_FLAGS[longestMatchingFlag])
                 else
-                    return invalidFlag ext
+                    return invalidFlag flagName
 
         flagString.pushBack(@flagsByProgram.all ? "",
                             @flagsByProgram[programIndex] ? "")

                i = 0
                longestMatchingFlag = null

            while i < ext.length
                for flag of currentMatchingFlags when flag[i] isnt ext[i]
                    delete currentMatchingFlags[flag]
                    --nMatching



# Testing code
###
timer = new Program "/home/albert/Dropbox/UPC/FIB/6eQuatri/PCA/Lab/sessio3/lab3_session/pi/pi.3g.StaTic.Pg"
console.log timer
timer = new Program "/home/albert/Dropbox/UPC/FIB/6eQuatri/PCA/Lab/sessio3/lab3_session/pi/pi.3gspg"
console.log timer
