Thanks. In the end it seems that my issue is actually that state values only have their initial state within the cleanup. I therefore had to set a local variable/flag on the state change cleanup and then use that flag to control logic in clean up with no dependencies