Have a go at making your lambda more like this.
code: !lambda return
I recall this kind of thing being possible but you really had to dig around the forum to discover the way to do it.
Edit: probably like this.
Edit 2:
I don’t think your retrieving state the right way either.
Breaking it up a bit using buttons is probably another decent approach rather than trying to do it all in one lambda.