Refactor the `Variables.add_reference` call to not expect a `Variable` object but a `Group` and a name
Fix the indexing for subexpressions that refer to linked variables.