changed the implementation for state machine