runCmds :: M.Map String Bool -> M.Map String LabelData -> [[String]] -> String
runCmds vars labels prog@([label]:rest)
    = case (value label vars, M.lookup label labels) of
        (True, Just (L labels' prog'))
            -> runCmds vars labels' prog'
        _   -> runCmds vars labels' rest
          where labels' = M.insert label (L labels' rest) labels
runCmds :: M.Map String Bool -> M.Map String LabelData -> [[String]] -> String
runCmds vars labels prog@([label]:rest)
    = case (value label vars, M.lookup label labels) of
        (True, Just (L labels' prog'))
            -> runCmds vars labels' prog'
        _   -> runCmds vars labels' rest
          where labels' = M.insert label (L labels' rest) labels
runCmds vars labels prog@([label]:rest)
    = case (value label vars, M.lookup label labels) of
        (True, Just (L labels' prog'))
            -> runCmds vars labels' prog'
        _   -> runCmds vars labels' rest
          where labels' = M.insert label (L labels' rest) labels