Trying to make a calculator in Snap!, but running into value problems

So, as the title says, I’m trying to make a calculator in Snap! but I’m facing some issues. Currently, I’m working on applying PEMDAS, specifically the P part of that problem, and how to solve the information in the parentheses. Namely, my Index variable doesn’t seem to be tracking correctly. Here’s a snippet of what’s happening: “Index should be the equal to the list length of SubEquations but reporting 0”

**What have you tried that didn’t work?
I’ve tried moving around my index resets, and even got rid of most of them as they did nothing, thinking that index was falsely being reset to 0, but that didn’t fix it or seem to do anything besides a minor readability increase.
**
Here’s the link to the project, simply open it and go to “see code”: https://snap.berkeley.edu/project?username=johnce&projectname=Snap%21%20Block%20Repository (it’s the “paresthesias Isolator” block, right click and edit)

Your algorithm won’t work in the case of nested parentheses, such as

1-(2*(3+4)/5)+6

The official right way to do this is to use recursion; when you see an open parenthesis you call your procedure, and when you see a close parenthesis you report a value. (In order to have the index into the input string not be reset to 0 in the recursive call, it has to be a block variable rather than a script variable: right click on the hat block in the Block Editor and choose the “block variables” option from the menu.)