Add support for definitions and references.  Fixes #2