Minor refactoring and bugfix.
Persist tree mode state in Routes tool window.