Replaced some dicts with sets.