Scene does not restart properly, some of the code does not work second time scene is called

Hello all, When screen is called for the second time levelsCompleted (located in the ifTouching statements at the bottom) does not increment.
To change scenes I am using a seperate collection of classes.


Level = class()

    local i
    local answerCheck
    local angle 
    local newX
    local newY
    local lilyradius = 35
    local star
    local outerRadius = {}
    local innerRadius = {}
    local lilyX = WIDTH/2 + 250 
    local lilyY = HEIGHT/2 - 100
    local numberOne = {}
    local numberTwo = {}
    local symbol = {}
    local equationText = {}
    local answer = {}
    
    local lilypadmini1
    local lilypadmini2
    local lilypadmini3
    local isitTouching = 0
    local stars
    local level = 1
    local counter = 0
    local direction = {}
    local timer = 0
    WrongAnswers = 0
    RightAnswers = 0
    
function Level:init()
    -- you can accept and set parameters here
    
    if(level>=11) then
        level = 1
        Scene.Change("Final",Final)
    end

    --turtle = SpriteObject("Dropbox:turtle", vec2(lilyX, lilyY))
    turtle1 = TurtleObject("Dropbox:turtle", vec2(lilyX, lilyY))
    lilypadmini = SpriteObject("Dropbox:lilypadmini", vec2(WIDTH/2 - 400, HEIGHT/2 - 250))   
    lilypadmini2 = SpriteObject("Dropbox:lilypadmini", vec2(WIDTH/2 - 400, HEIGHT/2))
    lilypadmini3 = SpriteObject("Dropbox:lilypadmini", vec2(WIDTH/2 - 400, HEIGHT/2 + 250))
    lilypadminicenter1 = SpriteObject("SpaceCute:Star", vec2(WIDTH/2 - 400, HEIGHT/2 - 250))    
    lilypadminicenter2 = SpriteObject("SpaceCute:Star", vec2(WIDTH/2 - 400, HEIGHT/2))
    lilypadminicenter3 = SpriteObject("SpaceCute:Star", vec2(WIDTH/2 - 400, HEIGHT/2 + 250))
    
    numberOne = {}
    numberTwo = {}
    symbol = {}
    answer ={}
    outerRadius = {}
    innerRadius = {}
    equationText = {}
    direction = {}
    timer = 0
    answerCheck = math.random(1, 3)
    
    for i = 1 , 3 do
        table.insert(numberOne, math.random(string.format("%d",((level+1)/2)),5 + string.format("%d",(level/2))))
        table.insert(symbol, math.random(1, 2))  
    
        if (symbol[i] == 1) then
            table.insert(numberTwo, math.random(string.format("%d",((level + 1)/2)),5 + string.format("%d",(level/2))))
            table.insert(answer, numberOne[i] + numberTwo[i])
            table.insert(equationText, numberOne[i] .." + ".. numberTwo[i] .." = ".. answer[i])
        else
            table.insert(numberTwo, math.random(1, numberOne[i]))
            table.insert(answer, numberOne[i] - numberTwo[i])
            table.insert(equationText, numberOne[i] .." - ".. numberTwo[i] .." = ".. answer[i])
        end
    end
                
    if (symbol[answerCheck] == 1)  then
        stars = answer[answerCheck]   
    else
        stars = numberOne[answerCheck]
    end
    slice = 2 * math.pi / stars
    for i = 1, stars do
        table.insert(innerRadius, 100 + math.random(30, 110))
        table.insert(outerRadius, 300)
        table.insert(direction, 0)          --default not moving
    end
     
    if (symbol[answerCheck] == 1) then                      -- adding
        for i = 1, numberTwo[answerCheck] do
            direction[i] = -1
            outerRadius[i] = innerRadius[i]
            innerRadius[i] = 300
        end
        for i = numberTwo[answerCheck], answer[answerCheck] do
            outerRadius[i] = innerRadius[i]
        end
    else                 --subtracting
        for     i = 1, answer[answerCheck] do
            direction[i] = -1
            outerRadius[i] = innerRadius[i]
        end
        for i = 1, stars do
            direction[i] = direction[i] + 1
        end
    end
end
    
function Level:draw()
    -- Codea does not automatically call this
    
    timer = timer + 1 
    counter = counter + 1
    if (counter >= 110) then
        counter = 0
    end
    background(0, 255, 212, 255) 
    lilypadmini:draw()
    lilypadmini2:draw()
    lilypadmini3:draw()
    fontSize(26)
    fill(0, 20, 255, 255)
    text("Drag the Happy Turtle to the correct equation shown above.", WIDTH/2, HEIGHT/2 - 350)
    
    fill(0, 25, 255, 255)
    fontSize(40)
    font("MarkerFelt-Wide")
    --text("Level "..level, WIDTH/2, HEIGHT/2 + 362)
    
    fontSize(23)
    fill(0, 22, 255, 255)
    text("Time: "..string.format("%d",(timer / 60)).." secs", WIDTH/2 + 410, HEIGHT/2 + 322)

    sprite("Dropbox:lilypad", WIDTH/2 + 170, HEIGHT/2)
    
    fontSize(33)
    fill(11, 216, 87, 255)
    text(equationText[1], WIDTH/2 - 400, HEIGHT/2 - 230)
    text(equationText[2], WIDTH/2 - 400, HEIGHT/2 + 20)
    text(equationText[3], WIDTH/2 - 400, HEIGHT/2 + 270)
    fill(116, 226, 143, 255)
    fontSize(25)
              
    font("MarkerFelt-Wide")
    fontSize(23)
    fill(255, 2, 0, 255)
    --text("Incorrect: "..WrongAnswers, WIDTH/2 + 410, HEIGHT/2 + 342)
    fill(65, 154, 81, 255)
    --text("Correct: "..RightAnswers, WIDTH/2 + 410, HEIGHT/2 + 362)
    
    turtle1:draw()
    
    -- This is the URL to where i found how to calculate points  on a circle for a given radius
    -- http://stackoverflow.com/questions/5300938/calculating-the-position-of-points-in-a-circle
    for i = 1, stars do
        angle = slice * i
        newX = string.format("%d", (lilyX) + (innerRadius[i] + counter * direction[i]) * math.cos(angle))
        newY = string.format("%d", (lilyY) + (innerRadius[i] + counter * direction[i]) * math.sin(angle))
        if(shape == 1) then
        star =  sprite("Dropbox:CircleButton", newX, newY)
          end
        if (shape == 2) then
      star = sprite("Dropbox:SquareButton", newX, newY)
        end
    
        end
end

function Level:touched(touch)
    -- Codea does not automatically call this method
    turtle1:touched(touch)
    
    if (turtle1:isTouching(lilypadminicenter1) == true) then
        if (answerCheck == 1) then
            isitTouching = 1
            RightAnswers = RightAnswers + 1
            levelsCompleted = levelsCompleted + 1
            saveLocalData("completed", levelsCompleted)
            sound("A Hero's Quest:Sword Hit 4")
        else
            isitTouching = -1
            WrongAnswers = WrongAnswers + 1
            sound("Game Sounds One:Pac Death 2")
        end 
        timerTotal = timerTotal + timer
        level = level + 1
        Scene.Change("levels", Level)
           
    elseif (turtle1:isTouching(lilypadminicenter2) == true) then
        if (answerCheck == 2) then
            isitTouching = 1
            RightAnswers = RightAnswers + 1
            levelsCompleted = levelsCompleted + 1
            saveLocalData("completed", levelsCompleted)
            sound("A Hero's Quest:Sword Hit 4")
        else
            isitTouching = -1
            WrongAnswers = WrongAnswers + 1
            sound("Game Sounds One:Pac Death 2")
        end
        timerTotal = timerTotal + timer
        level = level + 1
        Scene.Change("levels", Level)
    elseif (turtle1:isTouching(lilypadminicenter3) == true) then
        if (answerCheck == 3) then
            isitTouching = 1
            RightAnswers = RightAnswers + 1
            levelsCompleted = levelsCompleted + 1
            saveLocalData("completed", levelsCompleted)
            sound("A Hero's Quest:Sword Hit 4")      
        else
            isitTouching = -1
            WrongAnswers = WrongAnswers + 1
            sound("Game Sounds One:Pac Death 2")
        end
        timerTotal = timerTotal + timer
        level = level + 1
        Scene.Change("levels", Level)
    end
end

I suggest that you put in some print statements to make sure your entering the functions you think you are. Also, check the values of your “if” statements with print or use parameter.watch .