Add undo/redo functionality
Fixes clearing