This is the UI(state) diagram.