Made state tables into pointers, debugged initialisation.