Support reference uri & fix gobs of C code

Very, VERY, good idea. Added a description to the top of this function.