Updated FSM to be compiled. Reference errors need to be fixed.