finishing modifying state machine to use final structure. still working out issues with segmentation error and undefined references. compiles, but not working