Undo and redo support
Simplify code
Merge pull request #1 from adelgado/undo-and-redo-support

Undo and redo support