More useful implementation of the reference guard