added complete Undo functionality