use frozensets for efficiency and to avoid bugs