Some history encapsulation improvement.

This will make it easier to run the current router on top of a different
history implementation.