Added mechanism for getting the variables referenced by a loop (not just the modified vars)