undo working properly now