Add a reference() method to EditorHistory, updates references when time-traveling. Some code clean-up.