Use named class for UndoPair.

Use specific, named class for UndoPair instead of generic Tuple2. This
makes analysis of heap dumps much easier because profilers let you inspect
memory consumption on per-class basis.