initial (UNTESTED) implementation of refs and annotations