Support reference uri & fix gobs of C code

yikes. I don't even know what that comment means. This code is such copy-pasta. :(  I've removed the comment.