api.replace now supports undo. So does splitDuplicate
Add extra test to item class for more robust selections