* simplified the ref/ref_idx template voodoo a little