basic undo functionality working