Add Undo support

Fixes #16