Changes to for state machine implementation