commit prior to attempt at reworking indexing logic
found a couple of bugs (undeclared variables and state swapping in runToGen)