Moved the memory offset to the scope so the it gets reset when we leave a scope. We were just incrementing it for every variable in the program.