Replaced joystick logic to state machine