Refactored to simplify accessing TVars' values, especially operating on
sets.