Implementing grep and undo tree.