Moved state-dependent fit variables into own struct, added a new Reference Class interface to interact with, and incorporate appropriate serialization of variables so that objects can be saved/loaded.