Split primitive-undo into undo-primitive-undo, create elt-generator functions