refactor from if/else to Actor as a state machine