Rework to make use of FSM to simplify conditional behaviors