Attempt to fix the Heisenbug on MacOS release build. #190
The changes here are basically
replacing pointers with indices to refer to elements inside containers (I think this was the main reason for the memory corruption as those pointers became invalid when containers reallocate to hold more elements)
Attempt to fix the Heisenbug on MacOS release build. #190
The changes here are basically