refactor to state machine: fling
refactor state machine: all states