More work on state machine and popup labels