Check if in set on insertion instead of separately