Preparation for allowing the self-grounding of variables

These are a set of changes pertaining to the discussion in bug #1092
If the NO_SELF_GROUNDING token is not set, then the self-grounding of
variables should work.  I think. Its not well-tested, and could lead
to trouble.