refacIntroThreshold args =
  do let fileName = args!!0
         thresholdValue = args!!1
         thresholdName  = args!!2
         beginRow = read (args!!3)::Int
         beginCol = read (args!!4)::Int
         endRow   = read (args!!5)::Int
         endCol   = read (args!!6)::Int
     -- modName <- fileNameToModName fileName

     (inscps, exps, mod, tokList) <- parseSourceFile fileName

     unless ( isHidden ["rseq", "rpar", "runEval"] (concat  (findImportsHiddenLists mod)) == [] )
          $ error "rseq, rpar and/or runEval are explicitly hidden. Please unhide and try again."

     let theSeq = checkForQualifiers "rseq" inscps
         theRPar = checkForQualifiers "rpar" inscps
         expr = grabSelection (beginRow, beginCol) (endRow, endCol) tokList mod

     fileContent <- AbstractIO.readFile evalFilePath

     unless (fileContent /= []) $ error "No active eval monad! Please activate an evaluation monad to continue!"

     let runEval = read (fileContent) :: HsPatP

     -- add the threshold to the function...
     (m, tokList', mod', refactoredClients) <- generaliseDef2 fileName thresholdName (beginRow, beginCol) (endRow, endCol) (nameToExp thresholdValue) inscps exps mod tokList


     AbstractIO.putStrLn $ show (length refactoredClients)

     ((_,m'), (newToks, newMod)) <- applyRefac (doIntroduce expr thresholdValue thresholdName runEval theRPar theSeq) (Just (inscps, exps, mod', tokList')) fileName

     -- writeRefactoredFiles True [((fileName, m), (newToks, newMod))]

     writeRefactoredFiles False $ ((fileName, m'), (newToks, newMod)):refactoredClients

     AbstractIO.putStrLn "refacIntroThreshold Completed."
refacIntroThreshold args =
  do let fileName = args!!0
         thresholdValue = args!!1
         thresholdName  = args!!2
         beginRow = read (args!!3)::Int
         beginCol = read (args!!4)::Int
         endRow   = read (args!!5)::Int
         endCol   = read (args!!6)::Int
     -- modName <- fileNameToModName fileName

     (inscps, exps, mod, tokList) <- parseSourceFile fileName

     unless ( isHidden ["rseq", "rpar", "runEval"] (concat  (findImportsHiddenLists mod)) == [] )
          $ error "rseq, rpar and/or runEval are explicitly hidden. Please unhide and try again."

     let theSeq = checkForQualifiers "rseq" inscps
         theRPar = checkForQualifiers "rpar" inscps
         expr = grabSelection (beginRow, beginCol) (endRow, endCol) tokList mod

     fileContent <- AbstractIO.readFile evalFilePath

     unless (fileContent /= []) $ error "No active eval monad! Please activate an evaluation monad to continue!"

     let runEval = read (fileContent) :: HsPatP

     -- add the threshold to the function...
     (m, tokList', mod', refactoredClients) <- generaliseDef2 fileName thresholdName (beginRow, beginCol) (endRow, endCol) (nameToExp thresholdValue) inscps exps mod tokList


     AbstractIO.putStrLn $ show (length refactoredClients)

     ((_,m'), (newToks, newMod)) <- applyRefac (doIntroduce expr thresholdValue thresholdName runEval theRPar theSeq) (Just (inscps, exps, mod', tokList')) fileName

     -- writeRefactoredFiles True [((fileName, m), (newToks, newMod))]

     writeRefactoredFiles False $ ((fileName, m'), (newToks, newMod)):refactoredClients

     AbstractIO.putStrLn "refacIntroThreshold Completed."
refacIntroThreshold args =
  do let fileName = args!!0
         thresholdValue = args!!1
         thresholdName  = args!!2
         beginRow = read (args!!3)::Int
         beginCol = read (args!!4)::Int
         endRow   = read (args!!5)::Int
         endCol   = read (args!!6)::Int
     -- modName <- fileNameToModName fileName

     (inscps, exps, mod, tokList) <- parseSourceFile fileName

     unless ( isHidden ["rseq", "rpar", "runEval"] (concat  (findImportsHiddenLists mod)) == [] )
          $ error "rseq, rpar and/or runEval are explicitly hidden. Please unhide and try again."

     let theSeq = checkForQualifiers "rseq" inscps
         theRPar = checkForQualifiers "rpar" inscps
         expr = grabSelection (beginRow, beginCol) (endRow, endCol) tokList mod

     fileContent <- AbstractIO.readFile evalFilePath

     unless (fileContent /= []) $ error "No active eval monad! Please activate an evaluation monad to continue!"

     let runEval = read (fileContent) :: HsPatP

     -- add the threshold to the function...
     (m, tokList', mod', refactoredClients) <- generaliseDef2 fileName thresholdName (beginRow, beginCol) (endRow, endCol) (nameToExp thresholdValue) inscps exps mod tokList


     AbstractIO.putStrLn $ show (length refactoredClients)

     ((_,m'), (newToks, newMod)) <- applyRefac (doIntroduce expr thresholdValue thresholdName runEval theRPar theSeq) (Just (inscps, exps, mod', tokList')) fileName

     -- writeRefactoredFiles True [((fileName, m), (newToks, newMod))]

     writeRefactoredFiles False $ ((fileName, m'), (newToks, newMod)):refactoredClients

     AbstractIO.putStrLn "refacIntroThreshold Completed."