Developing of state machine for UI