Implement new external reference lookup

This is carryover from #7 to implement the feature described in #39.

-----

TODO:

- [x] wait for #7
- [ ] implement #39 
    - [ ] complete `Reference` class