change move logick to state machine