Corrected a major bug in State Transition in State Machine, going on to debug other issues