Yet more tests and work to handle references.  Changed so they are stored with tables that are on their endpoint.