This was the unfortunate side-effect of a mis-type around the 690th line. Where I posted: table.insert(data.activeGroup.group, 1). It should have been table.insert(data.activeGroup.group, l). Goes to show that any mistake can be unforgiving. I will post completed code when I am satisfied with it's operation.