Added undo and restart functionality