Simplify "if" and support copying "state undo" data from template node.