gui: Add lookup of references to the GUI

Some refactoring caused by this change.