implemented first version of undo